我需要一些帮助。我正在尝试从 php 脚本发送电子邮件。我的环境包括以下内容:
操作系统:Windows 8
XAMPP版本:1.8.2
PHP 版本:5.4.19
我有以下 php 脚本:
<?php
mail('[email protected] /cdn-cgi/l/email-protection','Helo','This is a test','From:[email protected] /cdn-cgi/l/email-protection');
?>
发送邮件配置文件的配置如下:
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=465
auth_username=sugar.donkey+gmail.com
auth_password=[MYPASSWORDHERE]
php.ini 上的配置:
[mail function]
; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
; SMTP = smtp.gmail.com
; smtp_port = 465
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost
当我运行 php 脚本时,我没有收到错误消息,但我似乎也没有收到电子邮件。我哪里出错了?
但是,我不确定您的网络服务器上运行的是什么操作系统;
大多数 Linux 安装都预装了 sendmail,设置 SPF/PTR 记录总是很麻烦,以确保 PHP 脚本发送的电子邮件不会被标记为垃圾邮件。名为 MSMTP 的 SMTP 客户端可用于使用第三方 SMTP 服务器发送电子邮件,PHP 的 mail() 也可以使用它来代替 sendmail。
我希望这有帮助
https://www.digitalocean.com/community/articles/how-to-use-gmail-or-yahoo-with-php-mail-function https://www.digitalocean.com/community/articles/how-to-use-gmail-or-yahoo-with-php-mail-function
另外对于本地主机测试,请检查一下。http://blogs.bigfish.tv/adam/2009/12/03/setup-a-testing-mail-server-using-php-on-mac-os-x/ http://blogs.bigfish.tv/adam/2009/12/03/setup-a-testing-mail-server-using-php-on-mac-os-x/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)