PHP邮件: – 做什么?

前端之家收集整理的这篇文章主要介绍了PHP邮件: – 做什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在使用电子邮件主机排除联系表单时,他们告诉我在PHP邮件功能的地址中使用“-f”. “-f”标志的作用是什么?为什么这样做可以让电子邮件发送?我读了一些文档,但我不清楚.

示例代码

mail($emailAddress,$mailSubject,$mailBody,$headers,'-f ' . $mailFrom);

PS:没有“-f”,它对于大型电子邮件主机(hotmail,gmail等,但无论什么原因都不适用于我正在使用的较小的主机)工作正常

谢谢

-f是邮件程序的一个参数(通常是sendmail).从 the docs

The additional_parameters parameter can be used to pass additional
flags as command line options to the program configured to be used
when sending mail,as defined by the sendmail_path configuration
setting. For example,this can be used to set the envelope sender
address when using sendmail with the -f sendmail option.

这是man page for sendmail,你可以看到-f选项是什么:

-fname           Sets the name of the ``from'' person (i.e.,the sender of the
                 mail).  -f can only be used by ``trusted'' users (normally
                 root,daemon,and network) or if the person you are trying to
                 become is the same as the person you are.
原文链接:https://www.f2er.com/php/130304.html

猜你在找的PHP相关文章