gpt4 book ai didi

PHP 邮件 : What does -f do?

转载 作者:可可西里 更新时间:2023-10-31 22:44:42 30 4
gpt4 key购买 nike

在对电子邮件主机的联系表单进行故障排除时,他们告诉我在 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.

关于PHP 邮件 : What does -f do?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8306576/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com