Specify FROM address

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
remlabm
Forum Newbie
Posts: 3
Joined: Tue Jan 09, 2007 5:46 pm

Specify FROM address

Post by remlabm »

I'm trying to figure out how to manually specify a from address. reasoning:

if the address is valid i want the reply to to be different than the bounce back address... Im trying to collect all bouncing addresses in a single..

if that doesn't make sense let me know and i will try to explain differently
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The address in the From: header is the one you give to send(). The bounce-back address (Return-Path, and "MAIL FROM" envelope) is the one passed to $swift->setReturnPath($address), or otherwise, the same as the From: address.

I was going to post a link to the relevant page in the documentation, but now I see why this question crops up so regularly... I forgot to document it :roll:

Code: Select all

$swift = new Swift( ... );

$from = "your@address.com";
$bounce_detect = "bounces@address.com";

$swift->setReturnPath($bounce_detect);
//

$swift->send($from, $to, $subject, $message);
remlabm
Forum Newbie
Posts: 3
Joined: Tue Jan 09, 2007 5:46 pm

Post by remlabm »

something interesting happens... these message im sending are to cell phones. some phones work fine with this method... others set the REPLY address as the BOUNCE address... is there anything that you might no about .... to help fix this?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

remlabm wrote:something interesting happens... these message im sending are to cell phones. some phones work fine with this method... others set the REPLY address as the BOUNCE address... is there anything that you might no about .... to help fix this?
Are you using Gmail? Gmail rewrite the email headers unless you add the email address you wish to send from to a list of allowed addresses.

Other SMTP servers could feasibly do the same thing if they are not intended to deliver mail for other domains primarily. It's certainly not a problem with Swift; the process of giving a bounce-detect address is extremely basic ;)
remlabm
Forum Newbie
Posts: 3
Joined: Tue Jan 09, 2007 5:46 pm

Post by remlabm »

no im not using gmail.. i have narrowed it down to the client.. for some reason it reads the last email in the header and sets that to the reply.

it only does it with one client though. everyone else has no issues. i used a work around method to fix this issue.

btw if you need someone to test swift4 php4 let me know i send about 10,000 a day.

and no i dont spam.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

remlabm wrote:no im not using gmail.. i have narrowed it down to the client.. for some reason it reads the last email in the header and sets that to the reply.

it only does it with one client though. everyone else has no issues. i used a work around method to fix this issue.

btw if you need someone to test swift4 php4 let me know i send about 10,000 a day.

and no i dont spam.
I will need somebody to (acceptance) test the PHP4 version shortly actually :) I'll likely just post the links here like I did with the PHP5 version. I've been busy with a Java project for the past week so haven't had a chance to work on it but I'm stuck with a references issue I may throw out to the smart people of this forum if I can't solve it soon. Even putting reference operators where I thought PHP5 would pass/assign by-reference by default it's not working somewhere :(

As for the client issue with the headers... how weird :? :)
Post Reply