0

I am using PHPMailer for sending email to the customer. Yesterday, It was working but from today morning It's not working. I am getting "Message sent" also getting some information but I am not getting the email.

Would you help me out in this?

Thanks in advance!

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!";
}
}
 ?>
user9437856
  • 2,360
  • 2
  • 33
  • 92

1 Answers1

0

It is possible that your E-Mail "disappeared" when it was classified as spam. There are a few things you can do about it.

  • Check https://www.spamhaus.org/zen/ if your server IP is listed there. If so, it is often classified as spam and there isn't really anything you can do about it except to change your server IP.

  • Check your SPF record. It is a text you can insert in your domain record. You can check your syntax here.

Otherwise you can check if the E-Mail even left your server or is stuck in a message query. To check this it depends on your software.

Lithilion
  • 1,097
  • 2
  • 11
  • 26
  • I just contact Hostgator team. They said there is no issue with email might be some issue with content. So I checked one by one all the content and found the issue in this line.$mail->FromName = "Buy-**********";(This is my text), I change it to other text and working perfectly. – user9437856 Mar 04 '18 at 10:28