Phpmailer and return-path

How do I set the return path using phpmailer?

TriDuo,

Try using the following (corrected for your use with a phpmailer object named mail):


<?php
	$mail->From = "Me@MyDomain.com";
	$mail->FromName = "Your Name";
	$mail->AddReplyTo("Me@MyDomain.com", "My Myself & I");
?>

Regards,

DK

Hi DK,

Thanks but that didn’t do the trick.
If the e-mail goes through, the AddReplyTo allows me to set where I want the reply to go but I’m looking to get responses for the e-mails that bounce.

When I look at the headers in my e-mail it shows
Return-Path: <apache@admin.mydomain.com>

I’d like it to be
Return-Path: <me@mydomain.com>

I’ve also tried extending the class as below but that hasn’t worked either
class MyMailer extends PHPMailer {
// Set default variables for all new objects
var $From = “me@mydomain.com”;
var $FromName = “TriDuo”;
var $Sender = “myself@mydomain.com”;
}

Any other solutions?

If you’re referring to this: http://phpmailer.sourceforge.net
then it should be defined with the $sender var, not?

so just edit line 74 of the class.phpmailer.php file.

Makes sense to me… but no guarantees :slight_smile:

TriDuo,

ColinF has suggested changing the DEFAULT From setting in the class.phpmailer.php file. That would still be overwritten by the assignments ( $mail->From = “TriDuo@mydomain.com”; and $mail->FromName = “TriDuo”; ) to the class variables.

From the look of your errors, though, it seems as if your SMTP setup in Apache is what’s being sent instead (<apache@admin.mydomain.com>). If this is on your own server, you can change this in the Apache configuration. If it’s on a shared server, your host will likely not allow this to be changed but should be able to tell you how to get around this.

I would expected $mail->From to have overridden the Apache’s From setting for you so I have to ask if you’ve tried these statements in your script (before attacking Apache’s config file).

Regards,

DK

I’m having similar trouble. The weird thing is, that everything works except AddReplyTo!

So, for example:


$mail->From=$Email;
$mail->FromName=$Name;
$mail->Subject=$EmailSubject;
$mail->AddAddress($ToEmailAddress,$ToName);

all work fine. But this one:


$mail->AddReplyTo($Email);

doesn’t seem to override the default nobody@cesiumx.myhost.com. Emails go through okay, but when they do bounce the go back to my host.

Anyone else had this trouble? Why would one line fail and all the other work okay???

Just to know, which phpmailer are you talking about ?
from xoops, sf, or the similar ?
edited, inherited ? you really affray me.
Quick test, quick modified and back and again and forth.

Could it be the last stage (SMTP) building the end message ?

You want Return-Path different from ReplyTo or do I miss the subject ?

I’m talking about this one: http://phpmailer.sourceforge.net/

you really affray me.
Quick test, quick modified and back and again and forth.

Sorry - I’m not sure what all that means… :blush:

But I haven’t edited the class.phpmailer.php file if that’s what you’re asking.

I don’t necessarily want it to be different, I just want it to be there. If I don’t specify anything, it’s the standard server address above. If I do specify an address using AddReplyTo() it makes no difference.

I haven’t specified it should use SMTP, and I haven’t even uploaded class.smtp.php… So if it were an SMTP issue the mail would probably not even send in the first place. I think.

this is a very old thread!.. sorry to reply to an old thread… just thought this will be useful to some one else…

to set the return path in phpmailer you have to use

$mail->Sender="mailer@example.com";

Ok. But what if I need to the return-path to be diferent from the Reply-to address??