Skip to content

Instantly share code, notes, and snippets.

@mlbd
Last active October 2, 2024 17:20
Show Gist options
  • Save mlbd/fc3b6e9763aa2e84e9967f5f354cc1f2 to your computer and use it in GitHub Desktop.
Save mlbd/fc3b6e9763aa2e84e9967f5f354cc1f2 to your computer and use it in GitHub Desktop.
----------------------------------------------------------------------
// C:\xampp\php\php.ini
----------------------------------------------------------------------
[mail function]
smtp_port=587
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
----------------------------------------------------------------------
// C:\xampp\sendmail\sendmail.ini
----------------------------------------------------------------------
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=your-gmail-password
[email protected]
If it still not send mail then config your gmail account following instruction.
https://support.google.com/accounts/answer/6010255
DONE and restert Apache and enjoy
@D3R1
Copy link

D3R1 commented Oct 2, 2024

I'm sure about my connection info but for some reason it's not working

this is the response from XAMPP in sendmail error log

Message is missing sender's address

I have checked all the settings and i have no idea what i missed :/

@mlbd
Copy link
Author

mlbd commented Oct 2, 2024

I haven't used Sendmail in a while, so I'm not sure what's causing the issue, but you could try adding [email protected] in the sendmail.ini file along with SMTP details like:

[email protected]
auth_password=your-gmail-password
[email protected]

2nd Method: If you are using PHP’s mail() function, ensure you're specifying the "From" header in your email. You can read more about mail headers here.

By the way, even if you're using wp_mail(), you also need to pass the "From" header inside the mail headers. There's a WordPress mail hook available to help with that as well.

@D3R1
Copy link

D3R1 commented Oct 2, 2024

I did try to add the from details in sendmail.ini and it didn't work, i think it has something to do with the sendmail_path...
when i remove the " either all or one i get successful echo message but of course no message ever sent.
anyway; thanks for the reply; I'll dig little bit deeper because i think it has something to do with my OS.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment