[wp-trac] [WordPress Trac] #53826: wp_mail_succeeded action in wp_mail()
WordPress Trac
noreply at wordpress.org
Thu Jul 29 14:08:02 UTC 2021
#53826: wp_mail_succeeded action in wp_mail()
-------------------------+-----------------------------
Reporter: birgire | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
To complement the {{{wp_mail_failed}}} action in {{{wp_mail()}}} we could
add the {{{wp_mail_succeeded}}} action.
Here's a suggestion to use e.g.:
{{{
$status = $phpmailer->send();
if ( $status ) {
$mail_data = compact( 'to', 'subject', 'message', 'headers',
'attachments' );
/**
* Fires after PHPMailer has successfully sent a mail.
*
* @since x.y.z
*
* @param array $mail_data An array containing the mail recipient,
subject, message, headers, and attachments.
*/
do_action( 'wp_mail_succeeded', $mail_data );
}
}}}
in {{{wp_mail()}}} instead of:
{{{
return $phpmailer->send();
}}}
ps: In BuddyPress we have e.g. both {{{bp_send_email_failure}}} and
{{{bp_send_email_success}}} actions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53826>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list