phpmailer - email sent but Gmail not receive

28 Views Asked by At

I'm using phpmailer in order to send emails. I succeed to send emails to some domain but not to GMAIL. phpmailer reply TRUE but no email received (Only for GMAIL)

I'll appreciate your help

    require("../assets/vendor/phpmailer/class.phpmailer.php");
    define ("SMTP_HOST", "mail.myDomain.app");
    define ("SMTP_USER", "[email protected]");
    define ("SMTP_PASS", "myPassword"); 
    
    $mail = new PHPMailer();

    $mail->IsSMTP();
    $mail->Host = SMTP_HOST;

    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "ssl";
    $mail->Port = 465;
    $mail->Username = SMTP_USER;
    $mail->Password = SMTP_PASS;


    $mail->IsHTML(true);
    
    $mail->CharSet = 'UTF-8';
    $mail->Subject = $email_subject;

    $mail->FromName = $_POST['name'];               
    $mail->From = $_POST['email'];
    $mail->AddReplyTo($_POST['email']);
    
    
    $mail->AddAddress($email_admin);
    
    $mail->Body = nl2br ($email_body);
    


    
    if($mail->Send())
        echo "true";
    else
        echo "false";

cPanel setting:

> Username: [email protected] Password: Use the email account’s
> password. Incoming Server:    mail.myDomain.app IMAP Port: 993 POP3 Port:
> 995 Outgoing Server:  mail.myDomain.app SMTP Port: 465 IMAP, POP3, and
> SMTP require authentication.

I sent the code above, got TRUE, but no email was received...

0

There are 0 best solutions below