简体   繁体   中英

I am using PHPMailer but mail not received in gmail

I received the mail continuously fine but suddenly I didn't receive any mail. I don't know what happened with my code also I didn't get any error in my error log file as well. I am using it on Godaddy server

$mails = new PHPMailer();
    $mail->IsSMTP();
    $mail->Host = "smtp.gmail.com";
    $mail->SMTPAuth = true;
    $mail->Port = 587;
    $mail->Username = "mymail@gmail.com";
    $mail->Password = "myPassword";
    $mail->From = "foo@gmail.com";
    $mail->FromName = "John Doe";
    $mail->AddAddress('foobar@foobar.com');

    $mail->IsHTML(true);
    $mail->Subject = "John Doe Lead Update";

    $mail->Body = '
        <h2>Mahindra Campaign Data</h2>';

        if($mail->send()){

            echo 'Message sent';
        }
           else
         {
            echo 'Mailer error' .$mail->ErrorInfo;
        }

May be GoDaddy server issue. If you are using shared hosting, there will be some limitations for sending emails. You can use third party services like mailchimp or you can use Amazon email services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM