Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queueing for a long time #47

Open
lubosdz opened this issue Mar 18, 2019 · 0 comments
Open

Queueing for a long time #47

lubosdz opened this issue Mar 18, 2019 · 0 comments

Comments

@lubosdz
Copy link

lubosdz commented Mar 18, 2019

Hi,

I understand that queueing works by serializing and unserializing whole swift mailer message object.

If the message object is set for posting into long future and in the meantime with some upgrade the swiftmailer message object changes, then unserializing will fail.

It would be much safer to store email as a binary text without unserializing - separate headers and body. Unserializing is not only error prone, but also stores bunch of useless object data (with swift message are also serialized other related in-memory swift objects).

We have customers who wants to send email reminder for example next year. With serializing/unserializing we could not do any safe upgrade of swift mailer until last email posted.

Unlike swift mailer, PHP mailer exposes two methods PreSend and PostSend. First one allows fetching separate headers & body as a binary text suitable to async post:

if($mail->PreSend()){
   // no serialized objects, just binary texts:
   $modelMail->header = $mail->getMIMEHeader();
   $modelMail->body = $mail->getMIMEBody();
   $modelMail->save();
}

Then next year without any dependency on mailer related objects we can just pull data from DB & post:

$modelMail->findOne(123);
$mail->setMIMEHeader($modelMail->header);
$mail->setMIMEBody($modelMail->body);
if($mail->PostSend()){
   ++$success;
}

That's why we cannot use swiftmailer, it's not suitable for queueing unlike PHPMailer - there is no method to store separately headers & body as a binary text in swift mailer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant