Can we compile and store messages as a draft in PHP mailer and then later on send each message?
It is possible to do this with PHPMailer. After configuring the PHPMailer instance with everything you'd normally need to send the message, do not call send() - instead call preSend() (which constructs the message) and then get the message content using getSentMIMEMessage(), e.g.
$mail->preSend();
$message = $mail->getSentMIMEMessage();
$message will then contain a complete RFC822 message which you can stick in a database, queue or whatever to send later. To do the actual sending later, you could make use of PHPMailer's SMTP class directly. To see how to drive that class, look at PHPMailer's smtpSend() function.
I don't think so PHPMailer supports this feature. But you can do this by using DB Table. Create a table in database to store messages, recipients, from, headers, etc and send them by PHPMailer later from a CRON job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With