Mailgun for WordPress 2.2.3 has 4 actions and 11 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when Mailgun for WordPress fires an action
add_action( 'phpmailer_init', function( $phpmailer ) {
// Your code runs here.
}, 10, 1 );
// Change a value Mailgun for WordPress is about to use
add_filter( 'wp_mail_charset', function( $charset ) {
// Change $charset here.
return $charset;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
phpmailer_init
action/** * Fires after PHPMailer is initialized. */ do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); -
wp_mail_charset
filter/** * Filters the default wp_mail() charset. */ apply_filters( 'wp_mail_charset', $charset ); -
wp_mail_content_type
filter/** * Filters the wp_mail() content type. */ apply_filters( 'wp_mail_content_type', $content_type ); -
wp_mail_failed
action/** * This filter is documented in wp-includes/pluggable.php */ do_action( 'wp_mail_failed', new WP_Error('wp_mail_failed', $e->getMessage(), $mail_error_data) ); -
wp_mail_from
filter/** * Filters the email address to send from. */ apply_filters( 'wp_mail_from', $from_email ); -
wp_mail_from_name
filter/** * Filters the name to associate with the "from" email address. */ apply_filters( 'wp_mail_from_name', $from_name ); -
mailgun_tags
filter/** * Filter tags. */ apply_filters( 'mailgun_tags', $body['o:tag'], $to, $subject, $message, $headers, $attachments, $region, $domain ); -
wp_mail_succeeded
action/** * 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. */ do_action( 'wp_mail_succeeded', $mail_data ); -
list_address
filterapply_filters( 'list_address', $instance['list_address'] ); -
mailgun_error_track
actiondo_action( 'mailgun_error_track', $error ); -
mg_mutate_attachments
filterapply_filters( 'mg_mutate_attachments', $attachments ); -
mg_mutate_message_body
filterapply_filters( 'mg_mutate_message_body', $body ); -
mg_mutate_to_rcpt_vars
filterapply_filters( 'mg_mutate_to_rcpt_vars', $to ); -
mg_use_recipient_vars_syntax
filterapply_filters( 'mg_use_recipient_vars_syntax', null ); -
wp_mail
filterapply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
Generated from Mailgun for WordPress's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Can't find the right hook?
We can build the customisation for you. Describe what you need: