I'm using delayed_job to send my welcome email asynchronously and it appears that the attachments in my e-mail isn't sent when I delay them.
If I use the code UserMailer.welcome_email(@user).deliver
the mail will be sent with the attachments, and the logs indicate that the email is sent as a multipart email.
But if I use the code UserMailer.delay.welcome_email(@user)
the mail will be sent, but without attachments, and the logs doesn't indicate that the email is sent as a开发者_开发技巧 multipart email.
Do I have to configure something special to make it work? I'm on Rails 3.0.9 and delayed_job 2.1.4.
Thanks!
I discovered what happened.
In my mailer, I did not have the line content_type "multipart/mixed"
since I thought that the mail gem would automatically handle that as outlined in http://guides.rubyonrails.org/action_mailer_basics.html#adding-attachments.
It turns out that letting the mail gem handle that will work when I don't delay sending the email, but this does not work when I delay it. Adding content_type "multipart/mixed"
to my mailer solves the problem.
However, I'm not sure if this is a bug with delayed_job, or whether I have a missing configuration.
精彩评论