Joomla 3.5.1 Mailing error

8 years 5 days ago - 8 years 5 days ago #1 by chrisc
Unfortunately Joomla 3.5.1 has introduced a change that has broken some of our components that send email, specifically Issue Tracker and Rialto. This silent change will also have probably impacted many other extensions as well.

The underlying problem is that in older versions of Joomla, the JMail::addReplyTo( ) function worked like this:
	/**
	 * Add Reply to email address(es) to the email
	 *
	 * @param   array  $replyto  Either an array or multi-array of form
	 *                           array([0] => email Address [1] => Name)
	 * @param   mixed  $name     Either an array or single string
	 *
	 * @return  JMail  Returns this object for chaining.
	 *
	 * @since   11.1
	 */
	public function addReplyTo($replyto, $name = '')
In Joomla 3, this quietly changed to
	/**
	 * Add Reply to email address(es) to the email
	 *
	 * @param   mixed  $replyto  Either a string or array of strings [email address(es)]
	 * @param   mixed  $name     Either a string or array of strings [name(s)]
	 *
	 * @return  JMail  Returns this object for chaining.
	 *
	 * @since   11.1
	 */
	public function addReplyTo($replyto, $name = '')

You will not immediately notice the subtle change to the first parameter. We confess that we do not read the entire source code of Joomla at every release, looking for subtle changes like this, hence did not notice the change. The function continued to work perfectly well until Jooomla 3.5.1 was released, when suddenly, without warning, it stopped working if called with the first parameter set to an array containing an email address and a name.

Until such time as we release updates to the affected components to fix this problem. The following edits of files upon on your server, will resolve the problem.

The simple solution is to change the code as follows:
$mail->addReplyTo(array($replyto, $replyname));

To this:
$mail->addReplyTo($replyto, $replyname);

The change is required is a few files unfortunately:

Issue Tracker
a) admin/components/com_issuetracker/helpers/issuetracker.php - several locations
b) site/components/com_issuetracker/controllers/cron.php - two locations
c) cli/issuetracker_email_overdue.php - one location
d) cli/ issuetracker_email_summary.php - one location

Rialto [Note that in Rialto the second parameter is $replytoname, otherwise the change is the same.]
a) site/component/com_rialto/models/entry.php - one location

There is a similar problem reported by Akeeba .

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

7 years 11 months ago #2 by geoffc
Replied by geoffc on topic Joomla 3.5.1 Mailing error
Further to this earlier post I discovered this post .

Of particular note is the last paragraph which I reproduce below:

One final thought (note, this was added after original publishing). The return from JMail::Send() is not a boolean value with the failed send result. The $result variable is overwritten with the result of a JError::raiseNotice() call, which returns a JException object. So if scripts are checking for a boolean false return, this only happens if the mailer is set offline in the global configuration. This could give a false impression that sending did succeed. Incidentally this is documented in the JMail::Send() doc block but is inconsistent with the parent PHPMailer::Send() method.


On reviewing our code we were indeed using the boolean return to check whether mail sending was successful. Yet another change we have to incorporate. Isn't it nice that these things are announced before a release is made! IF ONLY!

Regards
Geoff

Please Log in or Create an account to join the conversation.

Time to create page: 0.147 seconds
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries