If you are developing php project on localhost and you are using mail function on your project that time you may face problem with send mail function. so in this tutorial we are explain how to configure sendmail.

Follow the step below for configure sendmail:

Step 1: Download sendmail

Download sendmail and extract all the files in the folder “C:sendmail”

Step 2: Configure sendmail.ini

Open the file “C:sendmailsendmail.ini” and add the following params in the corresponding lines:

smtp_server=smtp.gmail.com
smtp_port=465
auth_username=your_address@gmail.com
auth_password=your_password
force_sender=your_address@gmail.com

Step 3 : Configure php.ini

Open the php.ini, find the following lines and add the path to the sendmail executable file. Don’t forget to restart the Apache server after doing that.

sendmail_path = "C:sendmailsendmail.exe -t"

Step 4: Test

Create a PHP script with the following code:(test.php)

mail('your_email@gmail.com','Test Mail Working','Mail received Successfully!!!!')

Run your test.php file and check your mail.