简体   繁体   中英

Sending email using DelayedJob gem in Rails

There is the following code for sending email asynchronously:

class OrderMailer < ActionMailer::Base
  default from: "some mail"

  def send_order_info(order) 
    @order = order
    mail(to: Settings.report_email, subject: "Some subject")
  end

  #handle_asynchronously :send_order_info
end

It code works, but if I remove comment from 'handle_asynchronously' line I can't send any email. What is the trouble? How can I fix it? Thanks.

如果您想在后台发送电子邮件,请执行

 OrderMailer.delay.send_order_info(@order)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM