0

I have placed the code of the PHPMailer in the file where I want to sent the mail but the mail is not delivered. I tried the ordinary mail() method but both sends the message but the message is not delivered. Can this be the issue with host service??

  include('PHPMailer-master/PHPMailerAutoload.php');
  $mail = new PHPMailer;
  // Set PHPMailer to use the sendmail transport
   $mail->isSendmail();
  //Set who the message is to be sent from
  $mail->setFrom('from@example.com', 'First Last');
  //Set an alternative reply-to address
   $mail->addReplyTo('replyto@example.com', 'First Last');
  //Set who the message is to be sent to
  $mail->addAddress( $_POST['RequestedEmail'], 'John Doe');
  //Set the subject line
  $mail->Subject = 'PHPMailer sendmail test';
  //Read an HTML message body from an external file, convert referenced  images to embedded,
 //convert HTML into a basic plain-text alternative body
 $mail->msgHTML("");
 //Replace the plain text body with one created manually
 $mail->AltBody = 'This is a plain-text message body';
  //send the message, check for errors
  if (!$mail->send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
  } else {
  echo "Message sent!";
}

Note: New to php

azam khan
  • 51
  • 9
  • What does `$mail->ErrorInfo` say? – Styphon Apr 10 '15 at 16:04
  • If messages are silently disappearing, it sounds like your local mail server is not working or is misconfigured. Check your mail server log, usually in `/var/log/mail.log`. – Synchro Apr 10 '15 at 16:15
  • possible duplicate of [send email using Gmail SMTP server through PHP Mailer](http://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer) – bhushya Apr 10 '15 at 16:25
  • Hey everyone.. Sorry.. I could not get back here.. yes the Hosting services technician replied and said the mails are being blocked by the spam blocker. – azam khan Apr 10 '15 at 21:47

1 Answers1

0

I tried both the mail() native function of the php and phpmailer. Both said that mail was sent and successful message appeared but the message was not delivered. I asked the technicians on the hosting server and they replied that spam blocker has blocked the messages. So they are asking for the contents and headers of the messages to confirm it was clear and to unblock the it from spamer. :)

azam khan
  • 51
  • 9