Send emails from local using XAMPP with SMTP


In this tutorial I will explain how you can send emails from local using XAMPP with SMTP settings. It will help you to check the display of the email body on your local system.

Open D:\xampp\sendmail\sendmail.ini file and change the below values :

smtp_server = smtp.gmail.com

smtp_port = 587

auth_username = your gmail id including @gmail.com (without quotes)

auth_password = your gmail password (without quotes)

force_sender = your gmail id including @gmail.com (without quotes)

Now open D:\xampp\php\php.ini file and change below:

sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"

Now you don’t need to use any SMTP details in your application. Just use php mail() function like below.

$msg = "testing SMTP mail";
mail("test@test.com","My subject", $msg);

Hope this tutorial will help you send emails from local using XAMPP with SMTP settings.