Please check these things before submitting your issue:
SMTPDebug = 2 setphpmailer, but search first!The expected working of function setFrom is set a header indicate the from field. But in the received mail, it shows the from address as the authenticated gmail address.
The example you've given in the readme

This is expected behavior, there is nothing wrong in PHPMailer itself.
The rewriting of the From address is done by Gmail for security reason (fight SPAM, phishing, etc.), not by PHPMailer. Gmail (and many others) doesn't allow sending messages with random From addresses.
To fix your problem, do one of:
Most helpful comment
This is expected behavior, there is nothing wrong in PHPMailer itself.
The rewriting of the From address is done by Gmail for security reason (fight SPAM, phishing, etc.), not by PHPMailer. Gmail (and many others) doesn't allow sending messages with random From addresses.
To fix your problem, do one of: