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
sendmail.ini that is located on
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).
[mail function] and change SMTP, smtp_port, sendmail_from and sendmail_path to the below code.
sendmail_from = email@example.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.
Change SMTP, Port, email and password according to your need. You can also use google SMTP setting to send emails from your localhost.