0

I am usng bluehost as server of my domain. I am using below code for sending mail using PHPMailer. The code does not through error and confirms that the mail has gone. But actually the mail does not go to recipient. can anyone suggest what is wrong here?

        $Recpnt1='abc@gmail.com';
        $emailfrom = 'xyz@AlphaBeta.com';

        require_once 'PHPMailer-master/PHPMailerAutoload.php';

        $mail = new PHPMailer;

        //From email address and name
        $mail->From = $emailfrom;
        $mail->FromName = "AlphaBeta";

        //To address and name
        $mail->addAddress($Recpnt1);

        //Send HTML or Plain Text email
        $mail->isHTML(true);

        // Your subject          
        $mail->Subject = "Your confirmation link here";                          

        $message='ABCD';

        $mail->Body    = $message;

        if($mail->send())
        {
            $error = $error . "Confirmation link Has Been Sent To Your Email Address.";              
        }
        else
        {
            $error = $error . 'Cannot send Confirmation link to your e-mail address';
        }          
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
MrC
  • 72
  • 7
  • 1
    Have you checked the SPAM folder ? Also, those two `$error = $error .` lines, is that what you intended to do ? – Himal Jul 20 '17 at 07:46
  • Oh yah! Thanks boss...they are there in SPAM ....thanks again...I lost my last 12 hour behind this stupid thing. Is there any way I can protect it from going into spam if actual recipients? – MrC Jul 20 '17 at 07:51
  • Unfortunately, there isn't a guaranteed way to do that. it depends on many factors. read the two articles provided in [this](https://stackoverflow.com/a/5935134/1189040) answer. you could also look into those "email delivery services". (google it) – Himal Jul 20 '17 at 08:10

0 Answers0