Home >Backend Development >PHP Tutorial >How to Configure XAMPP to Send Emails from Localhost?

How to Configure XAMPP to Send Emails from Localhost?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2025-01-01 01:01:10793browse

How to Configure XAMPP to Send Emails from Localhost?

Sending Mail from Localhost with XAMPP

To effectively send mail from localhost using XAMPP, it's essential to understand its configuration and integration with the sendmail package.

XAMPP natively includes the sendmail package, which allows you to send emails effortlessly from your local machine. To configure it effectively:

1. Configure php.ini:

In C:xamppphpphp.ini, remove the semicolon from the beginning of extension=php_openssl.dll to enable SSL support for Gmail.

Under [mail function], modify the following:

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

2. Configure sendmail.ini:

Open C:xamppsendmailsendmail.ini and replace the existing content with:

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=my-gmail-password
[email protected]

Remember to replace my-gmail-id and my-gmail-password accordingly.

3. For Gmail Integration:

For Gmail, access https://support.google.com/accounts/answer/6010255 to enable access for less secure apps.

Restart the server using the XAMPP control panel to apply the changes.

4. Linux Environment:

In Linux, you can use the sendmail package to send mail through Gmail with PHP Ubuntu Send email using gmail form localhost.

By implementing these steps, you can seamlessly reconfigure XAMPP to send emails from your localhost environment.

The above is the detailed content of How to Configure XAMPP to Send Emails from Localhost?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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