Search code examples
phpphpmailer

While sending mail with phpmailer it also send github with it, how to remove it?


I can send email with phpmailer perfectly but while i check "Show Original" in gmail it show me that there is a github link in my From address, like bellow:

From:   Tamjid Hasan <[email protected]> Using PHPMailer 6.0.6 (https://github.com/PHPMailer/PHPMailer) 

I want to know how to remove that github link. Anyone help me please.


Solution

  • The text you're seeing there comes from the X-Mailer header of the mail. In PHPMailer this can be defined with $mail->XMailer = "Your awesome mailer".

    If you check the source of the PHPMailer code you will find the following:

    /**
     * What to put in the X-Mailer header.
     * Options: An empty string for PHPMailer default, whitespace for none, or a string to use.
     *
     * @var string
     */
    public $XMailer = '';
    

    This means you could also set XMailer to ' ' to disable the header.