How to add custom header in batch send
Posted: Fri Sep 07, 2007 12:40 pm
feyd | Please use
Any help will be greatly appreciated.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
Im using the 3.2.4 and upgrading to the latest version today.
I have a batchsend that works great. Only change i'd like to add is a custom header with the campaign id so that when emails get bounced back to me, i can scan for the campaign id and work out the failure rate by campaign. Something like X-CAMPAIGN-ID: 49483
I also wanted to add a custom header for the from/send by to support "This message delivered by XXX on behalf of YYY". To do that i had to hardcode the header in the batchsend - which i know was a bad way to accomplish what i wanted.
This is my codebase:Code: Select all
Read records from database, add to the receipients array....
if ($count >= $max or $batchcount > 50) {
$smtp =& new Swift_Connection_SMTP("database", 26);
$swift =& new Swift($smtp);
$swift->batchSend($message, $recipients, $address);
unset($recipients);
$swift->disconnect();
if ($parms["transmission_id"] > 0) {
mysql_query("UPDATE store_campaign_transmission set email_address_number = $batchcount
WHERE transmission_id = '{$parms["transmission_id"]}'");
}
$count = 0;
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]