PHP邮件()函数头 [英] PHP Mail() Function Headers

查看:168
本文介绍了PHP邮件()函数头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我有一个PHP邮件功能。当我把它放在我的服务器上时它工作正常,但是当我把它邮寄给我的客户端时,他可以将它放在他的服务器上,它不起作用。它没有给我任何错误,他们的服务器上,并得到谢谢页面很好,但从来没有真正发送电子邮件。他们说这是因为PHP邮件没有正确的标题,但我认为它不需要标题,如果它只是简单地邮件(到,主题,消息)他们说,他们有所有PHP相关的功能设置正确,因为我最初认为这是PHP Mail被关闭。



任何建议都会很棒。

您应该始终使用FROM标头。


注意:

发送邮件时,邮件必须包含From头。这可以使用additional_headers参数设置
,或者可以在
php.ini中设置一个默认值。

如果不这样做,将导致类似于警告:
mail()的错误消息:sendmail_from未在php.ini或自定义From:标题
缺失中设置。 From头文件也设置Windows下的Return-Path。

这是直接从 mail()


OK, so I have a PHP mail function. It works fine when I put it on my server but when I put I mail it to my client so he can put it on his server it doesn't work. It doesn't give me any errors on their server and gets to the "Thanks" page just fine but never really sends the email. They say it's because PHP Mail does not have the right headers but I didn't think that it needed headers if it was just simply "mail(to, subject, message)" They say they have all PHP related functions set properly because I initially thought it was PHP Mail being turned off.

Any suggestions would be great.

解决方案

You should always be using a "FROM" header.

Note:

When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini.

Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows.

This is straight from the documentation for mail()

这篇关于PHP邮件()函数头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆