dongxi1320 2017-03-12 14:06
浏览 26

PHPMailer在更改互联网连接时不发送

I just wanna clear out. This Code is Working. But somehow I have a problem. I'm just a university student and I'm including this phpmailer for my email verification in the registration part of my project. In my house, this code is working. But, when I move to our university about one city away, the php mailer is now failing to send Email and it says "SMTP error()". My friends guess that since I moved location and changed internet connection, the error might be with the HOST and PORT. Is there any other way to make PHPMailer working without regards to my IP address, or my location, or my internet connection??

I can't see the answer within the link

https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

As I said before, this code used to work already. It's just that it does not function if I move to other location or other internet connection.

I hope somebody can help me with regards to this matter. I guess it's within the PORT and HOST.

This is my code:

require 'PHPMailerAutoload.php';
$mail = new PHPMailer();  

$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true; 
$mail->Username = "cspgryffindor@gmail.com"; 
$mail->Password = "cspgryffindor123"; 

$mail->setFrom('cspgryffindor@gmail.com', 'CSPGryffindor');
$to=$email;
$mail->From     = "no-reply@web.com";
$mail->AddAddress($to);  
$mail->AddReplyTo("no-reply@web.com","no-reply");
//$subject = "this is s1ubject";
//$msg="this is msg";
$mail->Subject  = $subject;
$mail->Body     = $message;
$mail->WordWrap = 150; 
if(!$mail->send()) 
{
  //  echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
   // echo "Message has been sent successfully";
}
  • 写回答

2条回答 默认 最新

  • doujiangao4229 2017-03-12 14:10
    关注

    Your new provider may have blocked the SMTP port, some of them do to prevent spam. You should check on their FAQ if they do.

    Unrelated but if your password is really cspgryffindor123, now is a good time to change it

    评论

报告相同问题?