map-mail-compose php return_path

stsights

New Member
Messages
159
Reaction score
0
Points
0
Hello. I have a trouble with the envelope return_path.
My php script has this.

$envelope["from"]= "info@mensajote.com";
$envelope["return_path"]= "info@mensajote.com";
$envelope["in_reply_to"]= "info@mensajote.com";
$envelope["reply_to"]= "info@mensajote.com";

But the email that I sent arrive with this.

Return-path: <@artic.x10hosting.com>
Envelope-to: sms@mensajote.com
Delivery-date: Sun, 05 Apr 2009 23:08:48 -0500
Received: from stsights by artic.x10hosting.com with local (Exim 4.69)
(envelope-from <@artic.x10hosting.com>)
id 1Lqg8Z-0002a8-3X
for sms@mensajote.com; Sun, 05 Apr 2009 23:08:43 -0500
To: sms@mensajote.com
Subject: DE: ss
From: info@mensajote.com
Reply-To: info@mensajote.com
In-Reply-To: info@mensajote.com
If you look the return_path is not changed to info@mensajote.com and it should be changed because in the script is correctly put in $envelope["return_path"]= "info@mensajote.com";

Could any one knows how to fix this error??

Thanks a lot guys.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
You didn't provide enough information. How are you sending the e-mail? When asking about code, always include a minimal test case. You did do a good job describing what you want the script to do and what it actually does.
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I believe that return path is the server (correct me if I'm wrong), so I think that it should be a server name. Try responding to your email. If it works, you should be good to go!
 

stsights

New Member
Messages
159
Reaction score
0
Points
0
Yes the return path is the server, is the cpanel username@name of the server.
I send the email via imap function
$envelope["from"]= "info@mensajote.com";
$envelope["return_path"]= "info@mensajote.com";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$mail =imap_mail_compose($envelope, $body);

imap_mail($tigo,$subject,'',$mail))


Return-path: <stsights@artic.x10hosting.com>
Envelope-to: sms@mensajote.com
Delivery-date: Sat, 20 Jun 2009 10:57:11 -0500
Received: from stsights by artic.x10hosting.com with local (Exim 4.69)
(envelope-from <stsights@artic.x10hosting.com>)
id 1MI2wD-0003L6-7I
for sms@mensajote.com; Sat, 20 Jun 2009 10:57:05 -0500
To: sms@mensajote.com
Subject: DE: aaa
From: info@mensajote.com
Reply-To: info@mensajote.com
In-Reply-To: info@mensajote.com
MIME-Version: 1.0
Content-Type: MULTIPART/mixed; BOUNDARY="2722458178-2108408561-1245513425=:12837"
Message-Id: <E1MI2wD-0003L6-7I@artic.x10hosting.com>
Date: Sat, 20 Jun 2009 10:57:05 -0500
X-x10hosting-MailScanner-Information: Please contact the ISP for more information
X-x10hosting-MailScanner-ID: 1MI2wD-0003L6-7I
X-x10hosting-MailScanner: Found to be clean
X-x10hosting-MailScanner-SpamCheck: not spam, SpamAssassin (not cached,
score=0.755, required 5, BASE64_LENGTH_79_INF 1.50, BAYES_20 -0.74,
NO_RELAYS -0.00)
X-x10hosting-MailScanner-From: stsights@artic.x10hosting.com
X-Spam-Status: No


but with this line $envelope["return_path"]= "info@mensajote.com"; the return path is not replaced with info@mensajote.com, I use the return path to receive an email that if the email that I send fails I receive the fail, but the fail is sent to
stsights@artic.x10hosting.com

Is any one that use the return_path just like me??
Thank you guys
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
Wait a second their... try using
PHP:
$envelope["return-path"]= "info@mensajote.com";
instead. If I am right, it's simply because return_path is not the same as return-path.
 
Last edited:

stsights

New Member
Messages
159
Reaction score
0
Points
0
I changed
$envelope["from"]= "info@mensajote.com";
$envelope["return-path"]= "info@mensajote.com";
$envelope["in_reply_to"]= "info@mensajote.com";
$envelope["reply_to"]= "info@mensajote.com";

And still appears

Return-path: <stsights@artic.x10hosting.com>
Envelope-to: sms@mensajote.com
Delivery-date: Sat, 20 Jun 2009 12:27:44 -0500
Received: from stsights by artic.x10hosting.com with local (Exim 4.69)
(envelope-from <stsights@artic.x10hosting.com>)
id 1MI4Ls-0002BJ-6p
for sms@mensajote.com; Sat, 20 Jun 2009 12:27:40 -0500
To: sms@mensajote.com
Subject: DE: ss
From: info@mensajote.com
Reply-To: info@mensajote.com
In-Reply-To: info@mensajote.com
MIME-Version: 1.0
Content-Type: MULTIPART/mixed; BOUNDARY="2722458178-575898766-1245518860=:8388"
Message-Id: <E1MI4Ls-0002BJ-6p@artic.x10hosting.com>
Date: Sat, 20 Jun 2009 12:27:40 -0500
X-x10hosting-MailScanner-Information: Please contact the ISP for more information
X-x10hosting-MailScanner-ID: 1MI4Ls-0002BJ-6p
X-x10hosting-MailScanner: Found to be clean
X-x10hosting-MailScanner-SpamCheck: not spam, SpamAssassin (not cached,
score=0.755, required 5, BASE64_LENGTH_79_INF 1.50, BAYES_20 -0.74,
NO_RELAYS -0.00)
X-x10hosting-MailScanner-From: stsights@artic.x10hosting.com
X-Spam-Status: No
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Note that the Return-path header is supposed to be added by the final mail server; even if you set it, it may be replaced.

The stock imap_mail_compose looks for "return_path" and adds it to the list of headers. However, the output of imap_mail_compose on X10 doesn't include the Return-path header. The code
PHP:
<?php
$envelope= array("from"=>"info@someplace.com",
				 'to'  => 'nemo@nusquam.net',
				 'cc' => 'nobody@nyet.net',
				 'bcc' => 'mother@ispy.net',
				 "return_path" => "info@someplace.com",
				 'reply_to' => 'info@someplace.com',
				 'in_reply_to' => 'id#DEADBEEF',
				 'message_id' => 'id#CAFEBABE',
				 'date' => 'now',
				 'subject' => 'stuff'
	);
$message='Message';
$body = array(
	array('type' => TYPETEXT,
		  'subtype' => 'plain',
		  'description' => 'one',
		  'contents.data' => "$message"),
	array('type' => TYPEAPPLICATION,
		  'subtype' => 'xml',
		  'description' => 'two: XML',
		  'contents.data' => "<?xml version='1.0'?>\n<msg><b>$message</b></msg>")
	);

echo imap_mail_compose($envelope, $body);
generates the output:
Date: now
From: info@someplace.com
Reply-To: info@someplace.com
Subject: stuff
To: nemo@nusquam.net
cc: nobody@nyet.net
In-Reply-To: id#DEADBEEF
Message-ID: id#CAFEBABE
MIME-Version: 1.0
Content-Type: TEXT/plain; CHARSET=US-ASCII
Content-Description: one

Message
Looks like imap_mail_compose isn't having problems with other headers, just Return-path. You could try using a 'custom_headers' entry in $envelope to add Return-path, but it will be added towards the bottom of the headers and the final mail server will probably add one at the top. Which one takes precedence depends on the mail client.

It could be x10 has a feature limited imap_mail_compose, or there could be something in imap_mail_compose. I'll take a closer look at the source later in case of the latter (unless you do it first).
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
I finally got around to looking over the source. Turns out the cause is in the IMAP c-client library. imap_mail_compose calls rfc822_header(), which only outputs specific headers, not including Return-path. imap_mail_compose then goes on to print custom headers itself.

Final analysis: there's no way to set Return-path using imap_mail_compose and reliably have the mail client get the value you want. Of course, you shouldn't be setting Return-path; the final mail server should. Setting Reply-to is the appropriate course, which you're already doing.
 
Last edited:

stsights

New Member
Messages
159
Reaction score
0
Points
0
Hi Misson.
Now I understand why the return-path is never changed, I assumed that the return-path it could be changed because I find some examples with imap_mail_compose using return_path but is not possible to do that.

Misson a final question the server do the final address in return_path, but just for imap_mail_compose or we can set the return_path in the headers of the mail?

Thank you for all your responses.
 

stsights

New Member
Messages
159
Reaction score
0
Points
0
Look at this some one had the same problem before

http://bugs.php.net/bug.php?id=30688
Edit:
$to='find_job@bk.ru';
$siteemail='admin@maydomain.com';
$subject = "This is subject";
$headers .= "From: $siteemail<$siteemail>\n";
$headers .= "X-Sender: <$siteemail>\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <$siteemail>\n";

$message = "This is the text.";

imap_mail ($to, $subject, $message , $headers) or die('send failed '.imap_last_error());

imap_close($mbox);

This code do not generate the return path now I see that is generated from the server
 
Last edited:
Top