Gmail SMTP icon
Email & Marketing

Gmail SMTP hooks reference

  • By Noor Alam
  • v1.2.3.24 New
  • Updated

Gmail SMTP 1.2.3.24 has 4 actions and 8 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.

functions.phpyour child theme
// Run your own code when Gmail SMTP fires an action
add_action( 'wp_mail_failed', function( $error ) {
	// Your code runs here.
}, 10, 1 );

// Change a value Gmail SMTP 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

  • main.php line 978 · used in 2 places
    /**
     * 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 ) );
  • main.php line 1165
    /**
     * Fires after PHPMailer is initialized.
     */
    do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
  • main.php line 1085
    /**
     * Filters the default wp_mail() charset.
     */
    apply_filters( 'wp_mail_charset', $charset );
  • main.php line 1064
    /**
     * Filters the wp_mail() content type.
     */
    apply_filters( 'wp_mail_content_type', $content_type );
  • main.php line 1131
    /**
     * Filters the arguments for PHPMailer's addEmbeddedImage() method.
     */
    apply_filters( 'wp_mail_embed_args', array( 'path' => $embed_path, 'cid' => (string) $key, 'name' => basename( $embed_path ), 'encoding' => 'base64', 'type' => '', 'disposition' => 'inline', ) );
  • wp_mail_from

    filter
    main.php line 960
    /**
     * Filters the email address to send from.
     */
    apply_filters( 'wp_mail_from', $from_email );
  • main.php line 969
    /**
     * Filters the name to associate with the "from" email address.
     */
    apply_filters( 'wp_mail_from_name', $from_name );
  • main.php line 1193
    /**
     * Fires after PHPMailer has successfully sent an email.
     */
    do_action( 'wp_mail_succeeded', $mail_data );
  • main.php line 587
    apply_filters( 'gmail_smtp_advanced_settings_fields', $settings_fields );
  • main.php line 581
    do_action( 'gmail_smtp_advanced_settings_submitted', $post );
  • gmailsmtp_cc

    filter
    main.php line 996
    apply_filters( 'gmailsmtp_cc', $gmailsmtp_cc );
  • main.php line 984
    apply_filters( 'gmailsmtp_reply_to', $gmailsmtp_reply_to );

Generated from Gmail SMTP'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: