Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to serialize and deserialise mailers?

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).

like image 855
Dmytrii Nagirniak Avatar asked Nov 07 '12 06:11

Dmytrii Nagirniak


Video Answer


1 Answers

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
like image 81
Yanhao Avatar answered Oct 14 '22 07:10

Yanhao