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:
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;
}
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]
I worked it out. Its the set->header method of the message object and not related to the transmission via SMTP.
Also, worked out that it was easier to setup an internal port just for non password enabled SMTP to avoid having to go through Authentication. Its only available on the internal IP address and it works a charm. Makes coding much simpler.
Noticed on Apache James, the userid you authenticate with, has to be the userid that is used in the FROM for the message. Thats normally ok, but not when you are delivering messages on behalf of your customers and you want the from to be your customers email address not your own. So for those of you struggling with JAMES, its much easier to disable SMTP authentication, then you can send the message from anyone you like, even if they dont have an account on your mail server.
billgoodyear wrote:Noticed on Apache James, the userid you authenticate with, has to be the userid that is used in the FROM for the message. Thats normally ok, but not when you are delivering messages on behalf of your customers and you want the from to be your customers email address not your own. So for those of you struggling with JAMES, its much easier to disable SMTP authentication, then you can send the message from anyone you like, even if they dont have an account on your mail server.
You might want to read up on SPF records because I see trouble not far down the road from you here You should never send from other people's addresses, you should instead make use of Reply-To SPF prevents what you're doing and spam blockers will increase their spam rating on your message the SPF rules from the domain have been breached.