Page 1 of 1

Reply-To in mail.php

Posted: Fri Sep 18, 2015 5:17 am
by jerry0000
v 2.0.3.1, in system/libary/mail.php, line 103-107:

Code: Select all

		if (!$this->reply_to) {
			$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->from . '>' . $this->newline;
		} else {
			$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->reply_to) . '?=' . ' <' . $this->from . '>' . $this->newline;
		}
I believe the "else" part is wrong. It should be:

Code: Select all

$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?=' . ' <' . $this->reply_to . '>' . $this->newline;

Re: Reply-To in mail.php

Posted: Fri Sep 18, 2015 1:59 pm
by deepvision
No, it is correct.
The second line executes only when the following condition is false:

Code: Select all

if (!$this->reply_to) {
It happens only when $this->reply_to has been defined. Because of the NOT logical operator: !

Re: Reply-To in mail.php

Posted: Sat Sep 19, 2015 6:00 am
by jerry0000
Please read it again. I actually tested and the original code is WRONG. My modified works. I know the NOT (!) operator there.

The original code will have the reply-to set as

Code: Select all

reply-to.email@domain2.com <from.email@domain1.com>
, which is incorrectly configured, as it will STILL reply to from.email@domain1.com! As you see, the mail program only cares the email inside the <>, if there are <> followed by the text field. In this case, the mail program treats the email address before the <> as SIMPLE text, where the sender name should be.

The correct reply to filed should be

Code: Select all

sender <repl-to.email@domain2.com>
.

Re: Reply-To in mail.php

Posted: Sat Sep 19, 2015 1:01 pm
by deepvision
It probably would have been more clear if you simply sent the modified code and not just referenced to the "second line"

Re: Reply-To in mail.php

Posted: Sun Sep 20, 2015 5:30 am
by jerry0000
I revised my wording, saying the "else" part is wrong.

Re: Reply-To in mail.php

Posted: Sun Sep 20, 2015 12:25 pm
by deepvision
Yes, you are right :)