#15539 closed defect (bug) (wontfix)
wp_mail() should allow using PHPmailer's SMTP feature
Reported by: | mastermind | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Keywords: | has-patch | |
Focuses: | Cc: |
Description
wp_mail()
is able to use an already existing instance of PHPmailer. Unfortunately, all settings from the existing instance are then reset.
While this makes sense for things like addresses and subject, it is very bad that $phpmailer->IsMail()
is called.
This makes it impossible to create and configure an own instance for usage with a remote MTA.
Possible solutions:
- Simply omit the call to
$phpmailer->IsMail()
, as'mail'
is already the default value.
- Move the call of
$phpmailer->IsMail()
into theif
statement at the beginning of thewp_mail()
function, so it will only be set if the instance is not set.
- Add a parameter to the signature of
wp_mail()
which allows to set the desired MTA backend.
Attachments (1)
Change History (7)
#1
@
13 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
#2
@
13 years ago
Ok, I didn't see the do_action_ref_array() at the bottom of wp_mail() – must have been some sort of blind spot.
I agree that this can be used as a workaround. Still, I think that simply omitting phpmailer->IsMail()
would be perfect: mail
is the default value of $phpmailer->Mailer
, so if the instance is fresh, it will be set anyway; if the instance is pre-set, any other value will be intentional.
#3
@
13 years ago
Right, but setting up the instance on your own really just isn't the best way to hook into this. Rather, modify the object directly on that hook.
It's best to rely on mail() by default, but other MTAs can be used if desired.
There's a way to handle this by leveraging the do_action_ref_array -- the phpmailer object can be passed to a callback and modified completely.
There's a plugin called WP Mail SMTP that handles this for example.
Re-reading the ticket, I don't object to #2.