wp_mail_succeeded
Fires after PHPMailer has successfully sent an email.
The firing of this action does not necessarily mean that the recipient(s) received the email successfully. It only means that the send method above was able to process the request without any errors.
Usage
add_action( 'wp_mail_succeeded', 'wp_kama_mail_succeeded_action' );
/**
* Function for `wp_mail_succeeded` action-hook.
*
* @param array $mail_data An array containing the email recipient(s), subject, message, headers, attachments, and embeds.
*
* @return void
*/
function wp_kama_mail_succeeded_action( $mail_data ){
// action...
}
- $mail_data(array)
An array containing the email recipient(s), subject, message, headers, attachments, and embeds.
-
to(string[])
Email addresses to send message. -
subject(string)
Email subject. -
message(string)
Message contents. -
headers(string[])
Additional headers. -
attachments(string[])
Paths to files to attach. - embeds(string[])
Paths to files to embed.
-
Changelog
| Since 5.9.0 | Introduced. |
| Since 6.9.0 | The $embeds element was added to the $mail_data array. |
Where the hook is called
wp_mail_succeeded
wp-includes/pluggable.php 651
do_action( 'wp_mail_succeeded', $mail_data );