[SOLVED] setReply and set returnPath

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
brunobraga
Forum Newbie
Posts: 6
Joined: Fri Jun 01, 2007 7:43 pm

[SOLVED] setReply and set returnPath

Post by brunobraga »

Hello.
I'm having some trouble setting reply to and setReturnPath.


Im have the following:
$message =& new Swift_Message($topic);
....
$message->setReturnPath("bounces@domain.com");
$message->setReplyTo("reply mail");
$message->attach(new Swift_Message_Part(""));
$message->attach(new Swift_Message_Part($content, "text/html"));

in my MESSAGE HEADER the return path and set replay is the same as the mail sender

What am i doing wrong..

Note: using php4

Best regards
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Which connection type are you using?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Also, if you're using batchSend() you'll have to make sure you've got the latest version of Swift (3.2.6) since there was a bug in the BatchMailer class which overrode headers in a handful of versions previous.
brunobraga
Forum Newbie
Posts: 6
Joined: Fri Jun 01, 2007 7:43 pm

Post by brunobraga »

SMTP, upgrading... perhaps thats the problem..
will post results in a few minutes

Regards and Thanks
brunobraga
Forum Newbie
Posts: 6
Joined: Fri Jun 01, 2007 7:43 pm

Post by brunobraga »

that was the problem.
thanks for the hlp.

Regards,
Bruno
rwebler
Forum Newbie
Posts: 1
Joined: Wed Oct 03, 2007 5:19 pm

ReturnPath ends up as From:

Post by rwebler »

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]


Hello. Swift is great, but there is a buggy behaviour I need help solving: the address we use as ReturnPath is incorrectly used as From (the one outside the envelope). I guess that's not the indended use of ReturnPath. We were using version 3.2.6, but an upgrade to 3.3.1 still let us with the problem. We use PHP5.2.1, and Sendmail as connection. The code is as follows:

Code: Select all

$swift = new Swift(new Swift_Connection_Sendmail());
$swift->attachPlugin(new Swift_Plugin_AntiFlood(200, 10), "anti-flood");

$message = new Swift_Message("Teste");
$message->attach(new Swift_Message_Part("Texto"));
$message->setReturnPath("example@example.com");

$html = file_get_contents("03_envio.htm");

... (build $replacements array)

$swift->attachPlugin(new Swift_Plugin_Decorator($replacements), "decorator");

$objHTML = new Swift_Message_Part($html,"text/html");
$message->attach($objHTML);


$swift->batchSend($message, $recipients, "realsender@example.com");
and the result is:

Code: Select all

From example@example.com  Wed Oct  3 16:58:43 2007
Return-Path: <example@example.com> 
...
From: realsender@example.com
The first from should be realsender@example.com.

I hope you can help me.

Best regards, and thanks again for this excellent tool.

Rodrigo


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]
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Swift doesn't do that, your ISP may be rewriting the headers in the same way Gmail does, or your mail client may simply be showing the Sender address rather than reading the From: header. Those headers are also syntactically incorrect since the From: is missing the colon. It looks more like an adjustment by the mail server to me since it also includes that date. Are you sure there's not a trailing space or two before the word "From"?
Post Reply