Search code examples
phpmailer

Changing Email address through phpmailer


Can I change <[email protected]> through phpmailer?

Screen shot


Solution

  • Yes. You can set the from address using the From property (and the name via the FromName property), or using the setFrom method to do both at once:

    $mail->From = '[email protected]';
    $mail->FromName = 'Akunatech support';
    

    or:

    $mail->setFrom('[email protected]', 'Akunatech support');
    

    That said, I can see you're sending through gmail, which does not allow you to use arbitrary from addresses (it will revert to your account address if you try), but you can configure aliases in gmail settings.