Forum: Ruby on Rails Setting "From" in Mailer model

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5294a9e9f890ea1947898e16f8148588?d=identicon&s=25 Luke Grimstrup (nazdrug)
on 2008-11-04 04:51
At the moment mail sent from my app comes from "mailer" when received by
gmail. Is it possible (i.e. some particular format) to make this more
meaningful?

What I have at the moment one of my typical mailer methods:

def updated
 recipients  users.collect(&:email).join(',')
 from        "mailer@domain.com"
 subject     some_subject
 body        <hash>
end
5294a9e9f890ea1947898e16f8148588?d=identicon&s=25 Luke Grimstrup (nazdrug)
on 2008-11-04 04:52
Whoops, by meaningful I mean, appearing in my inbox as coming from
"MyDomain.com Mailer" instead of just "mailer"

Luke Grimstrup wrote:
> At the moment mail sent from my app comes from "mailer" when received by
> gmail. Is it possible (i.e. some particular format) to make this more
> meaningful?
>
> What I have at the moment one of my typical mailer methods:
>
> def updated
>  recipients  users.collect(&:email).join(',')
>  from        "mailer@domain.com"
>  subject     some_subject
>  body        <hash>
> end
E3ba60e3dcb813f8abcd7732350e74cf?d=identicon&s=25 Phillip Koebbe (pkoebbe)
on 2008-11-04 15:42
Luke Grimstrup wrote:
> Whoops, by meaningful I mean, appearing in my inbox as coming from
> "MyDomain.com Mailer" instead of just "mailer"
>
> Luke Grimstrup wrote:
>> At the moment mail sent from my app comes from "mailer" when received by
>> gmail. Is it possible (i.e. some particular format) to make this more
>> meaningful?
>>
>> What I have at the moment one of my typical mailer methods:
>>
>> def updated
>>  recipients  users.collect(&:email).join(',')
>>  from        "mailer@domain.com"
>>  subject     some_subject
>>  body        <hash>
>> end

I use the format

from "Some Person <someperson@somedomain.com>"

Peace.
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2008-11-04 15:47
(Received via mailing list)
Luke Grimstrup wrote:
>> def updated
>>  recipients  users.collect(&:email).join(',')
>>  from        "mailer@domain.com"
>>  subject     some_subject
>>  body        <hash>
>> end

You'd write:

from 'MyDomain.com Mailer <mailer@domain.com>'

If the email sender is common to all mailer methods
you can move this "from" call to the initialize method,
so it only has to appear once.

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
5294a9e9f890ea1947898e16f8148588?d=identicon&s=25 Luke Grimstrup (nazdrug)
on 2008-11-05 22:29
Excellent! Just what I was looking for! :D
This topic is locked and can not be replied to.