gpt4 book ai didi

PHP 邮件最终变成了 gmail 垃圾邮件

转载 作者:行者123 更新时间:2023-12-04 06:01:39 24 4
gpt4 key购买 nike

一直在网上搜索并尝试了许多不同的解决方案,还有 phpmailer 和其他库。

我的目标是从我的网站发送确认邮件,它适用于 hotmail 和其他服务,但使用 gmail 最终会变成垃圾邮件。

使用 mail()功能,并且页面托管在 one.com 上并且确实存在发送邮件。

编码:

$mime_boundary = 'Multipart_Boundary_x'.md5(time()).'x';

$headers = "";

$headers .= 'MIME-Version: 1.0'."\r\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"{$mime_boundary}\"\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";

$body = "This is a multi-part message in mime format.\n\n";

# Add in plain text version
$body .= "--{$mime_boundary}\n";
$body .= "Content-Type: text/plain; charset=\"charset=us-ascii\"\n";
$body .= "Content-Transfer-Encoding: 7bit\n\n";
$body .= "To view the message, please use an HTML compatible email viewer!";
$body .= "\n\n";

# Add in HTML version
$body .= "--{$mime_boundary}\n";
$body .= "Content-Type: text/html; charset=\"UTF-8\"\n";
$body .= "Content-Transfer-Encoding: 7bit\n\n";
$body .= $this->_message;
$body .= "\n\n";

$body .= "--{$mime_boundary}--\n"; #

$headers .= 'From: Sender <sender@example.com>'."\r\n";
$headers .= 'Reply-To: Sender <sender@example.com>'."\r\n";
$headers .= 'Return-Path: Sender <sender@example.com>'."\r\n";

$headers .= 'Message-Id: <' . md5(uniqid(microtime())) . '@example.com>'."\r\n";
$headers .= "X-Sender-IP: ". $_SERVER['SERVER_ADDR'] ."\r\n";
$headers .= 'X-Mailer: PHP/'. phpversion() ."\r\n";

mail($this->_to, '=?UTF-8?B?'. base64_encode("Subject - ". $this->_subject) .'?=', $body, $headers, "-f sender@example.com");

最佳答案

就这么简单,检查域 one.com 是否被列入黑名单:

http://www.mxtoolbox.com/SuperTool.aspx?action=blacklist%3a195.47.247.192

关于PHP 邮件最终变成了 gmail 垃圾邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8836037/

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