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.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...