Reputation: 3091
Now i want to write one app which send emails millions each day by ruby, now i know there is some options such as net::smtp and actionmailer, maybe others, could someone recommend one better library so that i can use it to finish my task.
Thank you in advance.
Upvotes: 0
Views: 2717
Reputation: 6046
I would suggest using the mail gem. ActionMailer in rails 3 uses it under the hood and it works with 1.9.2 and jruby and there is loads of good documentation here: https://github.com/mikel/mail
Code example:
Mail.deliver do
from '[email protected]'
to '[email protected]'
subject 'Here is the image you wanted'
body File.read('body.txt')
add_file '/full/path/to/somefile.png'
end
Something else you might want to consider is using Sendgrid or Amazon SES to send email for you, they have all of the infrastructure already in place and ensure excellent deliverability.
Upvotes: 7
Reputation: 1016
There are many ways to do it.
Using smtp : link
If you are using Rails : link
If you want to use gems : pony
Upvotes: 1