Send Email from localhost XAMPP is the most common question that every php beginner ask. There are lots of tutorial on net which provide solution for this problem. But still lots of php beginners are unable to get the correct answer.
Your localhost XAMPP has the ability to send email but by default this functionality is disabled. So I am going to show you how to enable send email functionality on XAMPP. I am writing whole procedure in steps.
I will be working on 2 files that are php.ini
, normally located in xampp\php\php.ini
and sendmail.ini
that is located on xampp\sendmail\sendmail.ini
Also read
Let’s start
1) Open php.ini file. Shortcut way is go to xampp control panel. Click on Config button that is next to Apache and then click PHP (php.ini).
2) Find [mail function]
and change SMTP, smtp_port, sendmail_from and sendmail_path to the below code.
1 2 3 4 |
SMTP=smtp.yoursite.com smtp_port=25 sendmail_from = your_email@yoursite.com sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" |
3) Now go to xampp\sendmail\sendmail.ini file and change smtp_server, smtp_port, error_logfile, debug_logfile, auth_username, auth_password, force_sender.
1 2 3 4 5 6 7 |
smtp_server=smtp.yoursite.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log auth_username= your_email@yoursite.com auth_password=yourPassword force_sender=your_email@yoursite.com |
Change SMTP, Port, email and password according to your need. You can also use google SMTP setting to send emails from your localhost.