微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐