gpt4 book ai didi

php - 基本邮件功能(PHP)附加 "-f"参数问题

转载 作者:可可西里 更新时间:2023-11-01 13:57:42 26 4
gpt4 key购买 nike

-f附加参数是否在此邮件函数中正确设置。

@mail("example@exmaple.com.uy",$title,$body,$headers,"-f");

我从某些服务器收到 X 警告

很抱歉这个基本问题,但 documentation 的某些部分让我感到困惑(特别是一些用户评论)。

提前致谢!

最佳答案

来自手册:

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.

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

来源:http://www.astahost.com/info.php/Sending-Mail-Php39s-Mail-Function_t2728.html

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using 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. You may need to add the user that your web server runs as to your sendmail configuration to prevent a 'X-Warning' header from being added to the message when you set the envelope sender using this method. Example 3. Sending mail with extra headers and setting an additional command line parameter.

即:

<?php
mail("nobody@example.com", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}", "-fwebmaster@{$_SERVER['SERVER_NAME']}");
?>

在 -f 之后您需要设置外发电子邮件地址以防止警告(在本例中为 webmaster@-the domain-

关于php - 基本邮件功能(PHP)附加 "-f"参数问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4205228/

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