How de we send out 5000 emails per hour using actionmailer in ruby on rails?

后端 未结 4 1118
悲哀的现实
悲哀的现实 2020-12-09 23:47

I have some questions about ActionMailer :

  1. How does Actionmailer connect to a smtp server ?

  2. Are the connections c

4条回答
  •  清歌不尽
    2020-12-10 00:12

    1) Actionmailer connects to your smtp server via a set of parameters including a host, port and protocol.

    3) The effect will be a slow site as a result of the many synchronous tasks being executed.

    2 & 4)

    Actionmailer is a bit too slow to be sending out a ton of emails under load, remember that it is a synchronous operation and as such its not really the sort of thing you want to be doing a lot on a busy site.

    To be honest you're better off not sending that quantity of email from your website. It's not really designed to be used in such a way. If I had to send that sort of volume I'd look at doing the work in the background, something like Delayed Job would work well here or one of the many async rails mailers found here would do the trick.

    What you really want to look at here is the requirement that you're trying to fulfil, is it absolutely necessary that the website be responsible for sending the mail in a synchronous fashion? In most cases the answer to that question is no. If you can, you'll be far better off deferring this sort of task to another part of your system, keep your site as lean and focused as you can.

提交回复
热议问题