Now to explain my scenario:
I am using this script to e-Mail all my clients invoices every month. So I have a cron that generates the PDF's and then e-Mails the invoices through with the attachments. While I have this all in one loop, I would think it would be faster/less resource intensive to do this in a batchSend instead of using one send per run of the PDF generation loop?
My limits:
I have a 500 e-Mail limit per hour from my ISP with 60 pop checks per hour.
My script:
Code: Select all
require_once("includes/swift_mailer/lib/Swift.php");
require_once("includes/swift_mailer/lib/Swift/Connection/SMTP.php");
$swift =& new Swift(new Swift_Connection_SMTP("mail.osirion.co.za"))
while ($invoices_data = mysql_fetch_array($invoices_query))
{
/*Invoice generated into a pdf here*/
$message =& new Swift_Message("Invoice ". $invoices_data['invoice']);
$message->setContentType("text/html");
$message->attach(new Swift_Message_Part(new Swift_File("includes/invoice_template.html"), "text/html"));
$message->attach(new Swift_Message_Attachment(new Swift_File("invgendir/". $invoices_data['id'] .".pdf"), $invoices_data['id'] .".pdf", "application/pdf"));
$message->attach(new Swift_Message_Attachment(new Swift_File("images/logo.gif", "image/gif")););
$message->attach(new Swift_Message_Attachment(new Swift_File("images/header_top_splitter.gif", "image/gif")););
$swift->send($message, "client@clientsdomain.poo", "accounts@mydomain.wee");
}
$swift->disconnect();Thanks in advance