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

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法