Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setFrom didn't work as expected #3016

Closed
hafizewp22 opened this issue Feb 12, 2024 · 1 comment
Closed

setFrom didn't work as expected #3016

hafizewp22 opened this issue Feb 12, 2024 · 1 comment

Comments

@hafizewp22
Copy link

Please check these things before submitting your issue:

  • [V] Read the error message you're seeing - it often tells you what is wrong, and may contain useful links & instructions
  • [V] Make sure you're using the latest version of PHPMailer
  • [V] Check that your problem is not dealt with in the troubleshooting guide, especially if you're having problems connecting to Gmail or GoDaddy
  • [V] Include sufficient code to reproduce your problem
  • [V] If you're having an SMTP issue, include the debug output generated with SMTPDebug = 2 set
  • [V] If you have a question about how to use PHPMailer (rather than reporting a bug in it), tag a question on Stack Overflow with phpmailer, but search first!

Problem description

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.

Code to reproduce

Screenshot 2024-02-12 at 15 00 34

Debug output

Screenshot 2024-02-12 at 15 07 51
@Synchro
Copy link
Member

Synchro commented Feb 12, 2024

As the docs say, gmail doesn't let you forge from addresses. If you use anything other than your account address or a predefined alias, the from address will just be ignored. The right way to handle this is shown in the contact form example.

@Synchro Synchro closed this as completed Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants