Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActionMailer 3.0 drops name part in email

#5255

Example:

m = mail to: "Name <address@mail.com>"
m.to.first
#=> "address@mail.com"

Notice how the to: header drops the "Name" part of the address.

Edited by Rohit Arondekar for formatting.

Reported by eydaimon · July 30th, 2010 @ 08:04 PM

State: invalid
Milestone: none
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: Low

Activity

  1. eydaimon
    eydaimon
    • Tag changed from rails 3.0.rc to rails 3.0.0.beta3

    July 30th, 2010 @ 08:04 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • Importance changed from to Low

    However the information is not completely lost, it's stored somewhere.

        m = mail :to => "Name <address@mail.com>"
        m.inspect
        #<Mail::Message:26124640, Multipart: false, Headers: <From: from@example.com>, <To: Name <address@mail.com>>, <Subject: Welcome email>, <Mime-Version: 1.0>, <Content-Type: text/plain>>
    

    Did you have any specific issue or can this ticket be closed?

    October 7th, 2010 @ 06:51 AM

  3. eydaimon
    eydaimon

    E-Mail clients render the name field to display the email better, so it's definitely desired. It's standard, and I'm quite surprised you're suggesting just closing the ticket and ignoring this.

    October 7th, 2010 @ 03:59 PM

  4. Aditya Sanghi
    Aditya Sanghi
    • Assigned user set to Mikel Lindsaar

    @eydaimon , i think what rohit is trying to probably say is that email clients don't do "m.to.first" to display the sender. The mail object within a rails, has sufficiently stored the attributes of the mail message. Mail gem converts it into an email message and transfers it as per the RFC (cant recall the number just now) to the clients.

    I too disagree that m.to.first is sufficient evidence that this functionality is not working.

    After some introspection, i found that the way you probably want to test it is -

      m[:to].formatted == "Name <address@mail.com>".
    

    If you indeed think its a bug, you may want to raise it against the mail gem at http://github.com/mikel/mail but i doubt it will stand.

    Perhaps, Mikel can chime in since he is the maintainer of that gem as well as ActionMailer.

    October 7th, 2010 @ 05:31 PM

  5. eydaimon
    eydaimon

    @aditya, thanks for the clarification. I re-read the thread and you're correct. For some reason I thought it wasn't being included in the sent-mail when I responded again which is not true.

    Please close this ticket.

    October 7th, 2010 @ 06:51 PM

  6. David Trasbo
    David Trasbo
    • State changed from new to invalid

    Done!

    October 7th, 2010 @ 08:27 PM