XAMPP Sendmail using Gmail account
Solution 1:
This is what worked for me Hopefully no one else will burn oil to figure this out like i did.
Here is my sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=yourgmailpassword
[email protected]
php/php.ini ----basically comment everything out except sendmail_path & mail.add_x_header
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = localhost
; http://php.net/smtp-port
;smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "C:\xampp\apache\logs\php_mail.log"
This worked for me after i updated the sendmail files (the old ones dont support smtp)
- go to http://glob.com.au/sendmail/ and grab the latest sendmail zip file
- unzip to desktop and copy the files into your \xampp\sendmail folder replacing everything that was there.EVERYTHING!
- Now open up sendmail.ini and copy paste what i showed above.(remove everything in that file first or just comment everything out!)
- NOTE: you dont need Mercury servers started for this.
I was making a password recovery php on localhost when i encountered this problem. I needed to send users their password. - your php looks okey
Solution 2:
Okay, today, the best answer did not work for me. But, this did:
in sendmail.ini:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=****@gmail.com
auth_password=*******
force_sender=****@gmail.com
in php.ini:
[mail function]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Based on port @: http://support.google.com/mail/bin/answer.py?hl=en&answer=13287
Solution 3:
All I had to do was switch the "Allow less secure apps to access your account" to on. I guess this is an alternative to creating an app specific password.
https://support.google.com/accounts/answer/6010255 for info
https://www.google.com/settings/security/lesssecureapps for the switch
Might be worth switching it back off after you're done for security purposes.