Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No gem for this that I know of.</p> <p>Actually, due to processing issues, the best way would be to use external bulk email service provider via provider's API.</p> <p>However, building your own newsletter system is no different from building your regular MVC. Only addition are mailers and mailer views.</p> <p>(1) So you create model that deals with registration data (:name, :email, :etc...) and model that deals with newsletter itself.</p> <p>(2) Controller that deals with it (CRUD) + (:send). Send takes each recipient, sends data to mailer which creates email and then sends it.</p> <pre><code>def send @newsletter = Newsletter.find(:params['id']) @recipients = Recipient.all @recipients.each do |recipient| Newsletter.newsletter_email(recipient, @newsletter).deliver end end </code></pre> <p>(3) Mailer builds an email, makes some changes in each email if you want to do something like that and returns it to controller action send for delivery.</p> <pre><code>class Newsletter &lt; ActionMailer::Base default :from =&gt; "my_email@example.com", :content_type =&gt; "multipart/mixed" def newsletter_email(recipient, newsletter) # these are instance variables for newsletter view @newsletter = newsletter @recipient = recipient mail(:to =&gt; recipient.email, :subject =&gt; newsletter.subject) end end </code></pre> <p>(4) Ofc, you need mailer views which are just like regular views. Well in multipart there is:</p> <ul> <li>newsletter_email.html.erb (or haml)</li> <li><p>newsletter_email.txt.erb</p> <p>When you want to send both html and text only emails. Instance variables are defined in mailer ofc.</p></li> </ul> <p>And... that is it. Well you could use delayed job to send them since sending more than several hundred emails can take a while. Several ms times n can be a lot of time.</p> <p>Have fun.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload