The first release candidate for WordPress 4.0 is now available! In RC 1, we’ve made refinements to what we’ve been working on for this release. Check out the Beta 1 announcement post for more details on those features. We hope to ship WordPress 4.0 next week, but we need your help to get there. If you […]
@toscho Yes, but you loose context in fix_phpmailer() that you would have when calling wp_mail(). (unless you use globals, class variables if using a class).
For the record, accessing $phpmailer prior to calling wp_mail() won't work either, as wp_mail() 'cleans' the object.
@toscho mmm... that could work. I'd need to look into what ill-affects polluting the headers would have (if any), in case (for whatever) reason, cleaning up of the headers doesn't work. Thanks :)
@toscho You don't, but there are a lot of filters which plug-ins reply on in wp_mail(). Not using it breaks compatibility. Alternatively is to create a factory which does this set up on the phpmailer instance, but then I need to ensure that is in sync with WordPress core...
Might be the way to go though. I'm going to open a trac ticket and submit a patch to that affect. wp_mail() would then be reduced to a function which gets a new instance from the phpmailer factor, populates passed details (message/subject/recipients etc), and sends it.
@toscho wp_mail() calls $phpmailer->clearAttachments() -more generally it appears simply clean up the instance...
Understandable when you are leaving a global lying around. Wouldn't want to send last recipients email to the next recipient :). But why use a global here at all?
@toscho That seems hackiest solution yet..., clearAttachments() method which doesn't clear the attachments :).
@toscho Ah ok, that would explain the use of a global. But that would only be the case if run in a php5 environment, no? So it doesn't need to stay like that.