Action hook 'wp_mail_succeeded'

in WP Core File wp-includes/pluggable.php at line 568

View Source

wp_mail_succeeded

Action Hook
Description
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. }

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Action
Line Number 568

Hook Parameters

Type Name Description
array $mail_data { An array containing the email recipient(s), subject, message, headers, and attachments.

Usage Examples

Basic Usage
<?php
// Hook into wp_mail_succeeded
add_action('wp_mail_succeeded', 'my_custom_function', 10, 1);

function my_custom_function($mail_data) {
    // Your custom code here
}

Source Code Context

wp-includes/pluggable.php:568 - How this hook is used in WordPress core
<?php
 563  			 *     @type string   $message     Message contents.
 564  			 *     @type string[] $headers     Additional headers.
 565  			 *     @type string[] $attachments Paths to files to attach.
 566  			 * }
 567  			 */
 568  			do_action( 'wp_mail_succeeded', $mail_data );
 569  
 570  			return $send;
 571  		} catch ( PHPMailer\PHPMailer\Exception $e ) {
 572  			$mail_data['phpmailer_exception_code'] = $e->getCode();
 573  

PHP Documentation

<?php
/**
			 * 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.
			 *
			 * @since 5.9.0
			 *
			 * @param array $mail_data {
			 *     An array containing the email recipient(s), subject, message, headers, and attachments.
			 *
			 *     @type string[] $to          Email addresses to send message.
			 *     @type string   $subject     Email subject.
			 *     @type string   $message     Message contents.
			 *     @type string[] $headers     Additional headers.
			 *     @type string[] $attachments Paths to files to attach.
			 * }
			 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.