# ActionMailer not having to render message for each recipient

**URL:** <https://www.ruby-forum.com/t/actionmailer-not-having-to-render-message-for-each-recipient/104169>\
**Category:** Rails\
**Created:** [May 14, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/actionmailer-not-having-to-render-message-for-each-recipient/104169 "2007-05-14T23:00:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [May 14, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/actionmailer-not-having-to-render-message-for-each-recipient/104169/1 "2007-05-14T23:00:34Z")

</div>

Hi,

I was wondering if there was a way for actionmailer to not have to  
render a new email message and send it seperately for each user when  
everything stays the same except for one or two things.

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [May 15, 2007, 12:44am UTC](https://www.ruby-forum.com/t/actionmailer-not-having-to-render-message-for-each-recipient/104169/2 "2007-05-15T00:44:30Z")

</div>

Hi,

Le 14 mai 07, à 23:00, Aryk G. a écrit :

> I was wondering if there was a way for actionmailer to not have to  
> render a new email message and send it seperately for each user when  
> everything stays the same except for one or two things.

Same purpose. I tried:

```
   tmail = Mailing.create_mailing( {
     :subject => @title,
     :body => @content_html} )

   test_emails.each do |dest|
     tmail.to = dest
     Mailing.deliver(tmail)
   end

```

Works, except that the first mail in test\_emails never receives the  
mail 😕

## Jean-Christophe M.

> **[Édition et distribution de livres sur la musique, de partitions et de revues...](https://symetrie.com/fr)**
>
> Présentation des publications de Symétrie en musique, musicologie et médecine de la voix.

Better Nested Set for rails:  
[http://opensource.symetrie.com/trac/better\_nested\_set](http://opensource.symetrie.com/trac/better_nested_set)

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [May 15, 2007, 1:01am UTC](https://www.ruby-forum.com/t/actionmailer-not-having-to-render-message-for-each-recipient/104169/3 "2007-05-15T01:01:54Z")

</div>

Interesting, isn’t this the same as having an array for the recipients?

What I am saying is what if the body of the email says like “Dear  
, Hows it going?” but all you wanted to do is change the name  
between emails. How would we do that?

Jean-Christophe M. wrote:

> Hi,
> 
> Le 14 mai 07, ï¿½ 23:00, Aryk G. a ï¿½crit :
> 
> > I was wondering if there was a way for actionmailer to not have to  
> > render a new email message and send it seperately for each user when  
> > everything stays the same except for one or two things.
> 
> Same purpose. I tried:
> 
> ```
> tmail = Mailing.create_mailing( {
> :subject => @title,
> :body => @content_html} )
> 
> test_emails.each do |dest|
> tmail.to = dest
> Mailing.deliver(tmail)
> end
> 
> ```
> 
> Works, except that the first mail in test\_emails never receives the  
> mail 😕
> 
> ## Jean-Christophe M.
> 
> [symetrie.com](http://symetrie.com)
> 
> Better Nested Set for rails:  
> [http://opensource.symetrie.com/trac/better\_nested\_set](http://opensource.symetrie.com/trac/better_nested_set)
