Send Email From Localhost

Today i’m going to share setting to enable localhost to send mail. Basicly we gonna use the hosting’s smtp as your email setting in .ini file.

So we are going to edit 2 file : php.ini (mostly located in C:\xampp\php\php.ini) and sendmail.ini (mostly located in c:\xampp\sendmail\sendmail.ini).

After that go to your hosting to find your “smtp host” and “smtp port” for the .ini setting. So let’s start it.

PHP.INI :
– Find “extension=php_openssl.dll” and remove “;” from the beginning of the line.
– Find “[mail function]” and remove “;” from “SMTP” , “smtp_port” , “sendmail_from” , “sendmail_path”.
– Fill SMPT with your smpt hosting , ex : smtp.example.com
– Fill smtp_port with your smpt port hosting , ex : 111
– Fill sendmail_from with your email , ex : test@example.com

SENDMAIL.INI :
– Find “[sendmail]” and remove “;” from “smtp_server” , “smtp_port” , “error_logfile” , “debug_logfile” , “auth_username” , “auth_password” , “force_sender”.
– Fill smtp_server with your smpt hosting , ex : smtp.example.com
– Fill smtp_port with your smpt port hosting , ex : 111
– Fill auth_username with your email , ex : test@example.com
– Fill auth_password with your email’s password , ex : 123456
– Fill force_sender with your email , ex : test@example.com

Simply just like that, just try to create a code to send mail and see the result. To see the debug log, you browse to C:\xampp\sendmail\debug.log , it details all the mail process.

Leave a Reply

Your email address will not be published. Required fields are marked *