问题
How can I serialise the mailer so that it can be stored for further use?
The serialised data should be disconnected and self sufficient to be delivered on separate machine that should deliver that message (not knowing about database or anything else).
回答1:
Suppose you usually send emails with this:
MyMailer.some_email(...).deliver
Instead delivering it, you can convert it to a string and transfer the string to another server:
raw_mail = MyMailer.some_email(...).to_s
On another server, send the email:
Mail.new(raw_mail).deliver
来源:https://stackoverflow.com/questions/13264424/how-to-serialize-and-deserialise-mailers