Skip to content

Queueing for a long time #47

@lubosdz

Description

@lubosdz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions