发送消息但未使用PHPmailer获取电子邮件[重复]
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了发送消息但未使用PHPmailer获取电子邮件[重复]相关的知识,希望对你有一定的参考价值。
这个问题在这里已有答案:
我正在使用phpMailer向客户发送电子邮件。昨天,它工作但从今天早上起它没有用。我收到“发送消息”也获得了一些信息,但我没有收到电子邮件。
你能帮我解决这个问题吗?
提前致谢!
2018-03-04 06:49:12 CLIENT -> SERVER: EHLO test.com 2018-03-04 06:49:12 CLIENT -> SERVER: STARTTLS 2018-03-04 06:49:12 CLIENT -> SERVER: EHLO test.com 2018-03-04 06:49:12 CLIENT -> SERVER: AUTH LOGIN 2018-03-04 06:49:12 CLIENT -> SERVER: bm8tcmVwbHlAYnV5YnJhbmRlZHZpYWdyYS5jb20= 2018-03-04 06:49:12 CLIENT -> SERVER: UGFzcyNAMTIz 2018-03-04 06:49:12 CLIENT -> SERVER: MAIL FROM: 2018-03-04 06:49:12 CLIENT -> SERVER: RCPT TO: 2018-03-04 06:49:12 CLIENT -> SERVER: DATA 2018-03-04 06:49:12 CLIENT -> SERVER: Date: Sun, 4 Mar 2018 06:49:12 +0000 2018-03-04 06:49:12 CLIENT -> SERVER: To: test@gmail.com 2018-03-04 06:49:12 CLIENT -> SERVER: From: test_site 2018-03-04 06:49:12 CLIENT -> SERVER: Subject: test 2018-03-04 06:49:12 CLIENT -> SERVER: Message-ID: 2018-03-04 06:49:12 CLIENT -> SERVER: X-Priority: 3 2018-03-04 06:49:12 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/) 2018-03-04 06:49:12 CLIENT -> SERVER: MIME-Version: 1.0 2018-03-04 06:49:12 CLIENT -> SERVER: Content-Type: text/html; charset=UTF-8 2018-03-04 06:49:12 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2018-03-04 06:49:12 CLIENT -> SERVER: 2018-03-04 06:49:12 CLIENT -> SERVER: Test 2018-03-04 06:49:12 CLIENT -> SERVER: 2018-03-04 06:49:12 CLIENT -> SERVER: . 2018-03-04 06:49:12 CLIENT -> SERVER: QUIT Message sent!
的index.php
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="test2.php" method="post" enctype="multipart/form-data">
<input type="email" name="email" placeholder="email">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
test2.php
<?php
require_once('mail/class.phpmailer.php');
require_once('mail/PHPMailerAutoload.php');
$servername = "localhost";
$username = "username";
$password = "Pass#@123";
$dbname = "db";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$conn->set_charset('utf8');
if (isset($_POST['submit'])) {
$email=$conn->real_escape_string(trim($_POST['email']));
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true;
$mail->CharSet="UTF-8";
$mail->SMTPSecure = 'tls';
$mail->Host = 'md-**-**.****.***';//server name
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = 'no-reply@test.com';
$mail->Password = 'Pass#@123';
//$mail->SetFrom('no-reply@test.com');
$mail->From = 'no-reply@test.com';
$mail->FromName = "test";
$mail->AddAddress($email);//user email
//$mail->AddReplyTo('*****@gmail.com', 'Information');
$mail->Subject = "test";
$mail->AltBody = "";
$mail->Body = "Test";
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
}
?>
答案
当您的电子邮件被归类为垃圾邮件时,它可能会“消失”。你可以做些一些事情。
- 如果您的服务器IP列在那里,请检查https://www.spamhaus.org/zen/。如果是这样,它通常被归类为垃圾邮件,除了更改您的服务器IP之外,您无法做任何事情。
- 检查你的SPF记录。这是您可以在域记录中插入的文本。你可以查看你的语法here。
否则,您可以检查电子邮件是否已离开您的服务器或卡在消息查询中。要检查这一点,取决于您的软件。
以上是关于发送消息但未使用PHPmailer获取电子邮件[重复]的主要内容,如果未能解决你的问题,请参考以下文章
使用 SMTP PHPMailer 将不同的消息发送到不同的电子邮件帐户