【ERROR

    技术2022-07-01  98

    今日用php的mail函数发送邮件时,遇到如下问题:

    Warning: mail(): "send mail_from" not set in php.ini or custom "From:" header missing in...

     

    原因:php.ini文件中 send mail_from 项被屏蔽了,未开启,解决方法:开启即可。php.ini文件中发送mail的相关配置:

    [mail function]; For Win32 only.; http://php.net/smtpSMTP = localhost; http://php.net/smtp-portsmtp_port = 25

    ; For Win32 only.; http://php.net/sendmail-fromsendmail_from = me@example.com

     

    调整好上述配置后,又遇到如下问题:

    Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for

     

    原因未知,网上找到了解决方法:

    打开Internet信息服务(即iis),默认SMTP虚拟服务器->属性->访问->中继将那个 复选框选好,然后再添加了127.0.0.1的本地地址

     

    ok,至此该问题解决。

     


    最新回复(0)