Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


sendMail automatically adds sender as replyTo #1564

merged 1 commit into from

4 participants

Roberto Segura Chad Windnagle Sam Moffatt Philip Locke
Roberto Segura

Reference Tracker ID:

Please notice me if accepted to apply the same fix to CMS.

Chad Windnagle

+1 This is a simple change that will fix tons of issues. Many servers (like mine) require an at-domain sender email, but this causes problems when you want to reply to a site sender from an emailed form. Being able to set the header here is perfect, you get the proper send address, and a useful reply to address.

Sam Moffatt

So I dislike adding code that relies upon the internal structure of PHPMailer when we could add a simple $autoReplyTo = false on roughly line 457 and then add an else statement with $autoReplyTo = true. Alternatively we can flip the boolean here and put the $autoReplyTo = false inside the existing two if clauses.

Philip Locke

+1 Nice work Roberto... causes some of my clients huge issues.

Roberto Segura

@pasamio I thought about the same searching how to fix it.

I finally used this because JMail already extends PHPMailer and this approach allows you to use a $mailer->replyTo() and then a $mailer->sendMail() without the replyTo info. The mail will use the desired replyTo inserted because it checks its existence globally .

If we set the autoReply only based on the arguments received by sendMail that will stop working. So you will be creating another bug.

Sam Moffatt pasamio merged commit 252cf7d into from
Sam Moffatt

Fair enough, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 2, 2012
  1. Roberto Segura
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 libraries/joomla/mail/mail.php
5 libraries/joomla/mail/mail.php
@@ -441,7 +441,6 @@ public function useSMTP($auth = null, $host = null, $user = null, $pass = null,
public function sendMail($from, $fromName, $recipient, $subject, $body, $mode = false, $cc = null, $bcc = null, $attachment = null,
$replyTo = null, $replyToName = null)
- $this->setSender(array($from, $fromName));
@@ -471,6 +470,10 @@ public function sendMail($from, $fromName, $recipient, $subject, $body, $mode =
$this->addReplyTo(array($replyTo, $replyToName));
+ // Add sender to replyTo only if no replyTo received
+ $autoReplyTo = (empty($this->ReplyTo)) ? true : false;
+ $this->setSender(array($from, $fromName, $autoReplyTo));
return $this->Send();
Something went wrong with that request. Please try again.