[英]sending mail to gmail with an php script
1.using XAMPP and localhost i am trying to send mail to gmil from a php script. 1.使用XAMPP和本地主机,我试图从PHP脚本向gmil发送邮件。
2.after trying all the changes to the files php.ini and sendmail.ini as seen in posts and other resources i can't receive mail from my following php line of code: 2.在尝试对文件php.ini和sendmail.ini进行所有更改后,如帖子和其他资源所示,我无法从以下php代码行接收邮件:
<?php
mail('satanower1@gmail.com','hello this is a test','From: satanower1@gmail.com');
echo 'mail has been sent successfully.';
?>
i get back the echo statement but with no email at my inbox. 我取回echo语句,但收件箱中没有电子邮件。
changes i tried to the sendmail.ini 我尝试对sendmail.ini进行的更改
file:smtp_server=smtp.gmail.com from the xampp defoult smtp_port=465 (i tried other ports too as 25 etc..) 来自xampp的默认文件smtp_server = smtp.gmail.com smtp_port = 465(我也尝试过其他端口,例如25等)。
changes i tried to the php.ini file: SMTP = smtp.gmail.com and smtp_port = 465 我尝试对php.ini文件进行的更改:SMTP = smtp.gmail.com和smtp_port = 465
any help available? 有什么帮助吗?
You will need to enable SMTP access in GMAIL, also you need to allow unsecure clients: 您将需要在GMAIL中启用SMTP访问,还需要允许不安全的客户端:
https://www.google.com/settings/security/lesssecureapps https://support.google.com/mail/answer/75726 https://www.google.com/settings/security/lesssecureapps https://support.google.com/mail/answer/75726
sendmail config sendmail配置
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=465
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username==*****@gmail.com
auth_password=*********
force_sender=*****@gmail.com
php config PHP配置
[mail function]
SMTP=smtp.gmail.com
smtp_port=465
sendmail_from = *****@gmail.com
sendmail_path = "\"c:\xampp\sendmail\sendmail.exe\" -t"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.