douba7784 2013-10-16 14:15
浏览 79
已采纳

从免费服务器260mb发送邮件

I'm trying to send mails from my CodeIgniter webpage with PHPMailer. In fact, my code worked perfectly in localhost but when I uploaded it to the server (whose name's 260mb), I got this error message:

SMTP -> ERROR: Password not accepted from server: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 SMTP -> ERROR: MAIL not accepted from server: 530-5.5.1 Authentication Required.

These are the most important lines of my code (I don't write the other because they work well on localhost):

$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->Username = 'myemail@gmail.com';
$mail->Password = 'password_of_myemail@gmail.com';
$mail->From = 'myemail@gmail.com';
$mail->FromName = 'John';
$mail->AddAddress('otheremail@gmail.com');

After this, I tried to create two email accounts on my server, one of them for sending the message and the other to receive it. The changes I made on my code are these:

$mail->Host = 'localhost'; //Because both email accounts are on the server;
$mail->Port = 25;
$mail->Username = 'phpmailerfrom@mydomain.260mb.net';
$mail->Password = 'password_of_phpmailerfrom@mydomain.260mb.net';
$mail->From = 'phpmailerfrom@mydomain.260mb.net';
$mail->FromName = 'John';
$mail->AddAddress('phpmailerto@mydomain.260mb.net');

But in this case the errors are:

SMTP -> ERROR: Failed to connect to server: Connection refused (111) The following From address failed: phpmailerfrom@mydomain.260mb.net

I would appreciate a lot any help, especially if you could solve the first situation. I looked for a lot of information and may be the problem is the free server, in that case, how can I authorize mails in 260mb cPanel??

Thank you.

  • 写回答

1条回答 默认 最新

  • doujiang1939 2013-10-22 14:37
    关注

    Thank you for your help, but actually I could find the answer for my first question (not the second one):

    I had to click here:

    Unlock Google mail account

    And type the Google email which I was using to send mails in my code, and its password.

    Now, the first code I wrote in my question works.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码