How to configure xampp to send mail through localhost 2018?
As we all know that sending mail in xampp through localhost can be much more painful if we don’t know to configure xampp to send mail through localhost.
Then i thought it will be helpful to all if i can provide them easy solution. After spend my quality time on research finally i came with a solution which i am disclosing here.
Xampp is the local best server for php ,perl and mysql.XAMPP helps to create and develop your own applications using Web server technologies. Many people know from their own experience that it . Easy to use control panel.Lets come to the point of xampp setup to send mail through localhost.
Step 1 :
Lets write the php code in our editor can be Notepad++, PhpStrom, Sublime Text
The php code is shown in below:
we can send mail from localhost with sendmail package , sendmail package is in build in XAMPP.
So if you are using XAMPP then you can easily send mail from localhost.
for example you can configure C:\xampp\php\php.ini and c:\xampp\sendmail\sendmail.ini for gmail to send mail.
In C:\xampp\php\php.ini find extension=php_openssl.dll and remove the semicolon from the beginning of that line to make SSL working for gmail for localhost.
in php.ini file find [mail function] and change
sendmail_from = email@example.com
sendmail_path = “\”C:\xampp\sendmail\sendmail.exe\” -t”
Now Open C:\xampp\sendmail\sendmail.ini. Replace all the existing code in sendmail.ini with following code
Now you have done!! create php file with mail function and send mail from localhost.
Note: don’t forgot to replace my-gmail-id and my-gmail-password in above code.
Also, don’t forget to remove duplicate keys if you copied settings from above.
For example comment following line if there is another sendmail_path : sendmail_path=”C:\xampp\mailtodisk\mailtodisk.exe” in the php.ini file
Remember not to forget to restart xampp control panel so the changes take effect.
Check out the video tutorial to configure xampp to send mail through localhost.
Please follow and like us: