? Error

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
1 Oct 2013

Use 'new JMail' every time.

JMail::getInstance() currently re-uses an old object. If you send out several mails during one page load, you have to use new JMail objects, otherwise the recipient of the first mail will also get the second mail that you send with that object, since the list of recipients is not cleared after sending a mail.

avatar Hackwar Hackwar - open - 1 Oct 2013
avatar alwarren
alwarren - comment - 5 Dec 2013

JFactory::getMailer uses JMail::getInstance. You're going to log a warning even when using JFactory unless we change getMailer to new JMail.

I don't agree with removing the instance array. It would break BC for any extension that uses $id to create multiple instances. Personally, I like an instance array.

As for dealing with "old" data in the JMailer object, I would think it's more a matter of documenting proper usage rather than changing the core to accommodate improper usage.

avatar brianteeman
brianteeman - comment - 26 Jul 2014

Closed as per the comment on the tracker

avatar brianteeman brianteeman - change - 26 Jul 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-26 15:13:46
avatar brianteeman brianteeman - close - 26 Jul 2014
avatar brianteeman brianteeman - close - 26 Jul 2014

Add a Comment

Login with GitHub to post a comment