Title: fix_phpmailer_messageid
Published: April 25, 2014
Last modified: May 20, 2026

---

# fix_phpmailer_messageid( PHPMailerPHPMailerPHPMailer $phpmailer )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#wp--skip-link--target)

Corrects From host on outgoing mail to match the site domain.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#parameters)󠁿

 `$phpmailer`PHPMailerPHPMailerPHPMailerrequired

The PHPMailer instance (passed by reference).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#source)󠁿

    ```php
    function fix_phpmailer_messageid( $phpmailer ) {
    	$phpmailer->Hostname = get_network()->domain;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ms-functions.php#L2335)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-functions.php#L2335-L2337)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#related)󠁿

| Uses | Description | 
| [get_network()](https://developer.wordpress.org/reference/functions/get_network/)`wp-includes/ms-network.php` |

Retrieves network data given a network ID or network object.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#changelog)󠁿

| Version | Description | 
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/?output_format=md#comment-content-1531)
 2.   [Codex](https://profiles.wordpress.org/codex/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/fix_phpmailer_messageid/#comment-1531)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffix_phpmailer_messageid%2F%23comment-1531)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffix_phpmailer_messageid%2F%23comment-1531)
 4. **Example**
 5.     ```php
        fix_phpmailer_messageid( $phpmailer );
    
        echo $phpmailer->Hostname;
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffix_phpmailer_messageid%2F%3Freplytocom%3D1531%23feedback-editor-1531)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Ffix_phpmailer_messageid%2F)
before being able to contribute a note or feedback.