-1

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;
        }
Markus Zeller
  • 8,516
  • 2
  • 29
  • 35
  • Are you using it on local or server like godaddy? – Amanjot Kaur Oct 30 '19 at 07:40
  • This is not the PHP issue, it is a designing part –  Oct 30 '19 at 07:45
  • But when i use this code it's working fine but here i didn't add HTMl code $to = "sourav.mudgil@vermmillion.net.in"; $subject = "Mahindra Alturas Lead Update"; $message = 'Mahindra Campaign Data $header = "From:sourav.mudgil@gmail.com \r\n"; $retval = mail($to,$subject,$message,$header); if(isset($retval))//change { echo "Message sent successfully..."; } else { echo "Message could not be sent..."; } – Sourav Mudgil Oct 30 '19 at 07:47
  • Is the `From` address you are using actually different from the account you’re doing the SMTP authentication with here? Don’t do that, that is asking for trouble. – 04FS Oct 30 '19 at 09:51
  • You may want to have a look at answer on this thread: https://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer – Cortez90 Oct 30 '19 at 09:54
  • have you given permissions from ur gmail to sent mail from other sources?? – Shubham Narvekar Oct 30 '19 at 10:05

1 Answers1

0

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.

ramesh
  • 4,008
  • 13
  • 72
  • 117