User tests: Successful: Unsuccessful:
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.
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.
Closed as per the comment on the tracker
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-26 15:13:46 |
Here is the accompanying bug report: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31797&start=0