简体   繁体   中英

How to configure XAMPP to send mail from localhost to gmail?

I am trying to send mail from localhost.

I changed files php.ini and sendmail.ini and still not working. I am also turned on "Less secure app access" in Gmail account security

php.ini

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = my-email@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header=Off

sendmail.ini

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=my-email@gmail.com
auth_password=my-email-password
force_sender=my-email@gmail.com

You also need to allow less secure apps from your google account.

  1. Go to your Google Account.
  2. On the left navigation panel, click Security.
  3. On the bottom of the page, in the Less secure app access panel, click Turn on access.

https://support.google.com/accounts/answer/6010255?hl=en

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM