我在本地ubuntu 18机器上的开发环境中运行rails和redis。
ActionMailer正在适当地发送电子邮件,但是似乎我的电脑关机了,第二天我来启动redis,它重新发送了一堆电子邮件。
#invoice controller
InvoiceMailer.send_invoice_to_email(email, @invoice).deliver_later
#InvoiceMailer
def send_invoice_to_email(email, invoice)
@invoice = invoice
attachments["test_invoice_#{invoice.id}_#{Date.today}.pdf"] = WickedPdf.new.pdf_from_string(
render_to_string(pdf: 'Invoice', template: '/invoices/show.pdf.erb', layout: 'application')
)
bcc = ["test <test@test.com>", "test2 <test2@test.com>"]
mail(from: "Test <info@test.com>", to: email, bcc: bcc, subject: "Invoice From test")
end我的问题可能是什么,我该如何调试它?
发布于 2020-05-22 01:31:33
作为将来的参考-我相信没有重复的电子邮件被发送出去。我有一些逻辑上的问题。如果这种情况发生在你身上,首先确保sidekiq没有排队发送电子邮件,然后在同一时间发送出去。此外,如果你是通过发送实际的电子邮件来测试这一点,这会让人感到困惑-注意如何添加"to","cc","bcc“。
https://stackoverflow.com/questions/57328947
复制相似问题