i need to send an email for every row in a result set without using any services

29 views
Skip to first unread message

fugee ohu

unread,
Oct 5, 2015, 3:18:53 PM10/5/15
to Ruby on Rails: Talk
First, before you think to recommend I'm not gonna give my mailing list any third party services because I'm not giving them my precious mailing list to use or sell or disclose I just finished reading Agile Web Development with Rails and the book had no discussion of sending emails to every row in result set I have about 200 members in my database and need to send them all  an email once a month without using any third party services This shouldn't be a big deal  In perl this was nothing, but I'm not using perl anymore Can anyone point me to a good guide with examples or post example on here or gist please Thanks, fugee

Colin Law

unread,
Oct 5, 2015, 3:30:20 PM10/5/15
to Ruby on Rails: Talk
Have a look at
http://guides.rubyonrails.org/action_mailer_basics.html

Also all the other guides are worth looking through.

Colin

>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/f4a402f0-d75f-42d2-b6b7-95baccfab085%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

fugee ohu

unread,
Oct 5, 2015, 3:58:25 PM10/5/15
to Ruby on Rails: Talk
I"m sorry That's not right Anyone else?
That guide only discusses sending a single email to multiple recipients

Colin Law

unread,
Oct 5, 2015, 4:23:08 PM10/5/15
to Ruby on Rails: Talk
On 5 October 2015 at 20:58, fugee ohu <fuge...@gmail.com> wrote:
> I"m sorry That's not right Anyone else?
> That guide only discusses sending a single email to multiple recipients

That is what you said you wanted to do. You said you "need to send
them all an email once a month".

If you want to send a different email to each of them then just loop
through the users sending the personalised email.

Colin
> https://groups.google.com/d/msgid/rubyonrails-talk/d15b9ee6-daab-4554-8ebf-f19a5692ec20%40googlegroups.com.

tamouse pontiki

unread,
Oct 5, 2015, 5:00:01 PM10/5/15
to rubyonra...@googlegroups.com
On Mon, Oct 5, 2015 at 3:21 PM, Colin Law <cla...@gmail.com> wrote:
On 5 October 2015 at 20:58, fugee ohu <fuge...@gmail.com> wrote:
> I"m sorry That's not right Anyone else?
> That guide only discusses sending a single email to multiple recipients

That is what you said you wanted to do.  You said you "need to send
them all an email once a month".



I'm guessing the missing piece of this for the OP is the "once a month" bit.

There are two basic technologies at play here:

1. Send an email to multiple recipients: ActiveMail is that bit.
2. Do something periodically, e.g., once per month: ActiveJob is that bit.

For #1, Colin's already pointed you at it.
For #2, start with looking at the ActiveJob guide: http://guides.rubyonrails.org/active_job_basics.html and investigating cron and the whenever gem, sidekiq, resque, and so on.


 

Walter Lee Davis

unread,
Oct 5, 2015, 5:58:44 PM10/5/15
to rubyonra...@googlegroups.com

On Oct 5, 2015, at 4:59 PM, tamouse pontiki <tamous...@gmail.com> wrote:

> On Mon, Oct 5, 2015 at 3:21 PM, Colin Law <cla...@gmail.com> wrote:
> On 5 October 2015 at 20:58, fugee ohu <fuge...@gmail.com> wrote:
> > I"m sorry That's not right Anyone else?
> > That guide only discusses sending a single email to multiple recipients
>
> That is what you said you wanted to do. You said you "need to send
> them all an email once a month".
>
>
>
> I'm guessing the missing piece of this for the OP is the "once a month" bit.
>
> There are two basic technologies at play here:
>
> 1. Send an email to multiple recipients: ActiveMail is that bit.
> 2. Do something periodically, e.g., once per month: ActiveJob is that bit.
>
> For #1, Colin's already pointed you at it.
> For #2, start with looking at the ActiveJob guide:http://guides.rubyonrails.org/active_job_basics.html and investigating cron and the whenever gem, sidekiq, resque, and so on.
>

One last thing, even though you may not want to use an outside service because you don't want to expose your list, you can still use an outside service to get the delivery part right. I use (and recommend) SendGrid for this. There is also Mandrill, from MailChimp. Both of them let you offload the actual SMTP part of things to a hosted service that has deep experience delivering mail (and many many admins deeply good at keeping their servers off of the various blacklists out there). The "last mile" is a deeply hard problem, even when you are sending these sorts of opted-in messages to people who actively want them. Gmail and Yahoo mail make it very difficult to deliver mail to them from a Web server. This is something best left to the professionals.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t8%3Dq-EW2Yp-gaamsisaZ_nGP%3D9AXdicNoFSOWPAUb3yCw%40mail.gmail.com.

fugee ohu

unread,
Oct 5, 2015, 9:40:38 PM10/5/15
to Ruby on Rails: Talk
I figured it out thanks The guide you recommended was helpful Thanks again


On Monday, October 5, 2015 at 3:30:20 PM UTC-4, Colin Law wrote:
Reply all
Reply to author
Forward
0 new messages