PHP mail () - can not send mails to Gmail from localhost (xampp)

advertisements

For a school project I need to send e-mails from localhost to gmail. I have downloaded and copied all of the files from http://glob.com.au/sendmail/ and pasted them into my xampp/sendmail folder.

Here are my settings which should technically work.

sendmail.ini:

smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
[email protected]
auth_password=mypassword

php.ini:

sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
; SMTP = localhost
; smtp_port = 25


  1. Make sure you run sendmail.exe as an Administrator and in Compatibility Mode 'Windows XP (Service Pack 3)'. Right-click -> Properties -> Compatibility.
  2. Then visit the following link https://www.google.com/settings/security/lesssecureapps and Accept. Otherwise Gmail will block incoming requests.