Send email to any email account from localhost xampp and using php.
Most of the web projects have the email sending functionality. Before uploading to the live server email functionality need to be checked on the local server. But PHP mail() function will not work at the localhost. In this article, we’ll show how you can send email from localhost in PHP. Using this simple PHP script you can send email from any localhost server, like XAMPP, WAMP, or any others.
To using Gmail SMTP server, you should need to change account access for less secure apps. Don’t worry! Just follow the below steps.
Login to your google account.
Go to the Less secure apps settings page – https://www.google.com/settings/security/lesssecureapps
From Access for less secure apps section, select Turn on.
Some Changes From php.ini and gmail.ini file.
gmail.ini file.
line no 14. smtp_server=smtp.gmail.com
line no 18. smtp_port=587
line no 26. smtp_ssl=tls
line no 37. error_logfile.error.log remove semicolon ;
line no 42. debug_logfile.debug.log remove semicolan ;
line no 46. auth_username= Exmaple@gmail.com. //enter your email id
line no 47. auth_passwprd= password. //enter your proper password
line no 60. force_sender = Exmaple@gmail.com. //Same email
php.ini file changes
line no 1065. ; SMTP=localhost add semicolan;
line no 1067. ; smtp_port=25 add semicolan;
line no 1075. sendmail_path = c:\xampp\sendmail\sendmail.exe