GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送 [英] PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP

查看:107
本文介绍了GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过在StackOverflow和其他网站上发布的每个单独的脚本/代码/方法,但没有运气。我在GoDaddy上托管。我已经设置了一个Google App帐户,设置了MX记录所需的所有内容(使用GoDaddy工具),甚至尝试从我的网站的GMAIL界面发送一些电子邮件,以及通过我的一个unix终端中的SMTP发送一些电子邮件机器。这一切工作。

I have tried EVERY single script/code/method posted on StackOverflow and other sites for this, but with no luck. I am hosting on GoDaddy. I have setup a Google App account, set up everything needed for MX Records (using the GoDaddy tool for that), and even tried sending some emails from the GMAIL interface for my site, as well as through SMTP in terminal on one of my unix machines. It all worked.

然而,当我尝试使用PHP时,它不!它是否像GoDaddy阻止它?

HOWEVER, when I try using PHP, it doesn't! Is it like GoDaddy blocking it somehow?

我总是收到:

I always receive:


SMTP - >错误:无法连接到
服务器:连接被拒绝(111)SMTP
错误:无法连接到SMTP主机。
邮件程序错误:SMTP错误:无法
连接到SMTP主机。

SMTP -> ERROR: Failed to connect to server: Connection refused (111) SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.

这里是我使用的代码对于PHPMailer:

Here's the code I am using for PHPMailer:

<html>
    <head>
        <title>PHPMailer - SMTP (Gmail) advanced test</title>
    </head>
    <body>
    <?php
    require_once('../class.phpmailer.php');
    //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

    $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

    $mail->IsSMTP(); // telling the class to use SMTP

    try {
        $mail->Host       = "smtp.gmail.com"; // SMTP server
        $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
        $mail->SMTPAuth   = true;                  // enable SMTP authentication
        $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
        $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
        $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
        $mail->Username   = "MYFROMADDRESSHERE";  // GMAIL username
        $mail->Password   = "MYFROMPASSWORDHERE";            // GMAIL password
        $mail->AddReplyTo('MYFROMADDRESSHERE', 'Sender Name');
        $mail->AddAddress('TESTTOADDRESSHERE', 'Recipient Name');
        $mail->SetFrom('MYFROMADDRESSHERE', 'Sender Name');
        $mail->AddReplyTo('MYFROMADDRESSHERE', 'Sender Name');
        $mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
        $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
        $mail->MsgHTML(file_get_contents('contents.html'));
        $mail->AddAttachment('images/phpmailer.gif');      // attachment
        $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
        $mail->Send();
        echo "Message Sent OK</p>\n";
    } catch (phpmailerException $e) {
        echo $e->errorMessage(); //Pretty error messages from PHPMailer
    } catch (Exception $e) {
        echo $e->getMessage(); //Boring error messages from anything else!
    }
    ?>
</html>

谢谢!

Thanks!

推荐答案

如前所述, GoDaddy已知阻止传出的SSL SMTP连接,以强迫您使用他们自己的传出邮件服务器。

As discussed previously, GoDaddy has been known to block outgoing SSL SMTP connections in favor of forcing you to use their own outgoing mail server.

这几乎是冰山一角,关于GoDaddy作为一家公司,注册商和虚拟主机的巨大不安。 Ditch'em。

This is pretty much the tip of the iceberg, with regard to the immense suckitude of GoDaddy as a company, registrar and web host. Ditch'em.

这篇关于GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆