但是,当我尝试使用PHP时,却没有!难道GoDaddy会以某种方式阻止它吗?
我总是收到:
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的代码:
<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>
谢谢!
解决方法 如前所述,GoDaddy has been known to block outgoing SSL SMTP connections赞成强制您使用自己的外发邮件服务器.对于GoDaddy作为公司,注册商和网站主持人的巨大骄傲,这几乎是冰山一角. Ditch’em.
总结以上是内存溢出为你收集整理的GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送全部内容,希望文章能够帮你解决GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)