I know this is elsewhere on the site but for some reason the answers I\'ve found on here still haven\'t helped I still can\'t get it to work after trying different things al
You can just configure C:\xampp\php\php.ini and c:\xampp\sendmail\sendmail.ini for Gmail to send mail.
In php.ini file find [mail function] and change following
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = your-gmail-id@gmail.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
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=your-gmail-id@gmail.com
auth_password=your-gmail-id-password
force_sender=your-gmail-id@gmail.com
Now you have done!! create a PHP file with mail function and send mail from the localhost.
Note:- Replace your email id with "your-gmail-id@gmail.com"
if you are sending mail through local server you need to configure
c:\xampp\sendmail\sendmail.ini
(send by Gmail) and C:\xampp\php\php.ini
.
in php.ini
find extension=php_openssl.dll
and remove the semicolon from the beginning of that line. So this allow you to send mail from localhost.
and then find mail function
and change below settings
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = my-gmail-id@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
in sendmail.ini(path - C:\xampp\sendmail\sendmail.ini
)
Change this
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=GMail ID@gmail.com//your gmail ID
auth_password=GMail PASSWORD // Your gmail password
force_sender=GMail ID@gmail.com //your gmail ID
Change GMail ID@gmail.com, GMail PASSWORD, GMail ID@gmail.com in above code.
Finally
comment following line if there is another sendmail_path : sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
in the php.ini file.