# Setting "From" in Mailer model

**URL:** <https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455>\
**Category:** Rails\
**Created:** [November 4, 2008, 4:51am UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455 "2008-11-04T04:51:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![galeal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@galeal](https://www.ruby-forum.com/u/galeal)\
**Post date:** [November 4, 2008, 4:51am UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455/1 "2008-11-04T04:51:43Z")

</div>

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 “removed\_email\_address@domain.invalid”  
subject some\_subject  
body   
end

---

<div class="post-metadata">

**Author:** ![galeal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@galeal](https://www.ruby-forum.com/u/galeal)\
**Post date:** [November 4, 2008, 4:52am UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455/2 "2008-11-04T04:52:54Z")

</div>

Whoops, by meaningful I mean, appearing in my inbox as coming from  
“[MyDomain.com](http://MyDomain.com) Mailer” instead of just “mailer”

Luke G. 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 “removed\_email\_address@domain.invalid”  
> subject some\_subject  
> body   
> end

---

<div class="post-metadata">

**Author:** ![galeal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@galeal](https://www.ruby-forum.com/u/galeal)\
**Post date:** [November 4, 2008, 3:42pm UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455/3 "2008-11-04T15:42:32Z")

</div>

Luke G. wrote:

> Whoops, by meaningful I mean, appearing in my inbox as coming from  
> “[MyDomain.com](http://MyDomain.com) Mailer” instead of just “mailer”
> 
> Luke G. 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 “removed\_email\_address@domain.invalid”  
> > subject some\_subject  
> > body   
> > end

I use the format

from “Some P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)”

Peace.

---

<div class="post-metadata">

**Author:** ![galeal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@galeal](https://www.ruby-forum.com/u/galeal)\
**Post date:** [November 4, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455/4 "2008-11-04T15:47:53Z")

</div>

Luke G. wrote:

> > def updated  
> > recipients users.collect(&:email).join(‘,’)  
> > from “removed\_email\_address@domain.invalid”  
> > subject some\_subject  
> > body   
> > end

You’d write:

from ‘[MyDomain.com](http://MyDomain.com) Mailer [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)’

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](http://railswheels.com)

---

<div class="post-metadata">

**Author:** ![galeal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@galeal](https://www.ruby-forum.com/u/galeal)\
**Post date:** [November 5, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/setting-from-in-mailer-model/152455/5 "2008-11-05T22:29:33Z")

</div>

Excellent! Just what I was looking for! 😃
