Home > Backend Development > PHP Tutorial > Why Aren't My Emails Sent from XAMPP's Localhost to Gmail?

Why Aren't My Emails Sent from XAMPP's Localhost to Gmail?

Barbara Streisand
Release: 2024-12-19 05:49:46
Original
522 people have browsed it

Why Aren't My Emails Sent from XAMPP's Localhost to Gmail?

Troubleshooting Email Delivery from Localhost with XAMPP and Gmail Mail Server

When attempting to send emails from a localhost running XAMPP using the PHP mail() function, users may encounter issues where the return message indicates successful delivery but no emails are received. To resolve this, follow these steps:

Configure PHP.ini for Gmail Mail Server:

  • Open php.ini and configure the following settings:

    • SMTP = smtp.gmail.com
    • smtp_port = 587
    • sendmail_from = [email protected]
    • sendmail_path = "C:xamppsendmailsendmail.exe -t"

Install Fake Sendmail for Windows:

  • Download and install "fake sendmail for windows" from http://glob.com.au/sendmail/sendmail.zip

Configure sendmail.ini for Gmail Account:

  • Open sendmail.ini in the sendmail installation directory and configure:

    • smtp_server=smtp.gmail.com
    • smtp_port=587
    • smtp_ssl=tls
    • auth_username=[email protected]
    • auth_password=[password]
    • force_sender=[email protected]

Generate Application-Specific Password for Gmail:

  • If using a Gmail account with 2-factor verification, create an application-specific password at https://myaccount.google.com/security. Use this password in sendmail.ini.

Additional Tips:

  • Ensure that port 587 is open on the firewall.
  • Check the sendmail error log for any errors.
  • Use a third-party SMTP service like Mailtrap to debug email delivery.

The above is the detailed content of Why Aren't My Emails Sent from XAMPP's Localhost to Gmail?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template