邮件未送达gmail

邮件未送达gmail,gmail,php,Gmail,Php,我正在使用PHP邮件功能发送邮件,它将被发送到所有其他邮件服务器,但不是gmail 这是我的标题 $headers = "From: Somename<sales@domain.net>\r\n"; $headers .= "Reply-To: sales@domain.net\r\n". $headers .="Return-Path: sales@domain.net\r\n"; $headers .= "Content-Type: text/html; charset=IS

我正在使用PHP邮件功能发送邮件,它将被发送到所有其他邮件服务器,但不是gmail

这是我的标题

$headers = "From: Somename<sales@domain.net>\r\n";  
$headers .= "Reply-To: sales@domain.net\r\n".
$headers .="Return-Path: sales@domain.net\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .='X-Mailer: PHP/' . phpversion();
$headers=“From:Somename\r\n”;
$headers.=“回复:sales@domain.net\r\n”。
$headers.=“返回路径:sales@domain.net\r\n“;
$headers.=“内容类型:text/html;字符集=ISO-8859-1\r\n”;
$headers.='X-Mailer:PHP/'。phpversion();

任何帮助都将不胜感激。谢谢。

据我所知,您没有获得代码的其余部分,因此我可以看出有什么问题 所以我会把我用gmail发送电子邮件的代码发给你

代码:

    $sendmail = require_once('../lib/phpmailer/class.phpmailer.php');
include("../lib/phpmailer/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body = " Body Msg ";

$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = "smtp.gmail.com"; // sets the SMTP server
$mail->Port       = 465;                    // set the SMTP port for the GMAIL server
$mail->Username   = "mail@gmail.com"; // SMTP account username
$mail->Password   = "pass";        // SMTP account password

$mail->SetFrom('$qemail', 'first name');

$mail->Subject    = "hi name";

$mail->MsgHTML($body);

$address = "mail@gmail.com";
$mail->AddAddress($address, "first name");

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
}
如果您想尝试代码,请不要忘记在include函数和require_once中为类设置正确的位置

$headers .= "Reply-To: sales@domain.net\r\n".
在标题中而不是

$headers .= "Reply-To: sales@domain.net\r\n";

您输入了“.”而不是“;”,这就是它导致错误的原因。

您好,这在“相关”列中已经有许多重复项。GMail可能检测到它是垃圾邮件,尤其是在共享主机提供商上。您的服务器/PHP安装是否支持使用mail()函数?此外,您是否检查了垃圾邮件/垃圾邮件等?您是否检查了垃圾邮件文件夹?您可能需要检查邮件是否在垃圾邮件框中。OK将尝试这样做。谢谢您。是的,我在+1之前使用了php mailer类,尽管我的问题已在删除$headers时得到解决。=“返回路径:sales@domain.net\r\n”。fom标题