我有一个简单的邮件功能:
$to = 'someone@somedomain.com';
$cc = 'someother@somedomain.com';
$bcc = 'someotherother@somedomain.com';
$sub = 'Some Subject';
$body = $html;
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/html; charset=iso-8859-1";
$headers[] = "From: Fancy Name <from@email.com>";
$headers[] = "Reply-To: Fancy Name <from@email.com>";
$headers[] = 'CC: '. $cc;
$headers[] = 'BCC: '. $bcc;
mail($to, $sub, $body, implode("\n", $headers));
这适用于Windows但不适用于CentOS - 日志返回&#34;信封来自地址apache @ host是否允许&#34; (或类似的东西)。
注意到这一点,作为第5个参数,你可以传递-f from@email.com,这确实有效。但它没有显示为Fancy Name,它显示了电子邮件地址 - 如何才能使标题正常工作或将名称传递给-f param?
由于
答案 0 :(得分:0)
尝试运行这段代码并告诉我
template<typename T>
class Vector {
public:
T& operator[](size_t i) {
return const_cast<T&>(
static_cast<const Vector<T>*>(this)->operator[](i));
}
const T& operator[](size_t i) const {
return data[i];
}
private:
T* data;
};
答案 1 :(得分:0)
找到解决方案:
按照您的意愿和第5个参数执行标题-f email @ domain -F&#34;发件人名称&#34; e.g。
$to = 'someone@somedomain.com';
$cc = 'someother@somedomain.com';
$bcc = 'someotherother@somedomain.com';
$sub = 'Some Subject';
$body = $html;
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/html; charset=iso-8859-1";
$headers[] = "From: Fancy Name <from@email.com>";
$headers[] = "Reply-To: Fancy Name <from@email.com>";
$headers[] = 'CC: '. $cc;
$headers[] = 'BCC: '. $bcc;
mail($to, $sub, $body, implode("\n", $headers), '-f from@email.com -F "Fancy Name"');