2014-01-25 92 views
1

當我嘗試使用此PHPMailer方法使用mandrill發送郵件時,它顯示爲SMTP Connect()失敗的錯誤。這是我的代碼:Mandrill PHPMailer給出錯誤:SMTP連接()失敗

<?php   
    require 'class.phpmailer.php';  
    $mail = new PHPMailer; 
    $mail->IsSMTP();   
    $mail->Host = 'smtp.mandrillapp.com';  
    $mail->SMTPSecure = 'tls';      
    $mail->Port = 587;          
    $mail->SMTPAuth = true;         
    $mail->Username = 'MANDRILL_USERNAME';     
    $mail->Password = 'API_KEY';      
    $mail->From = '[email protected]'; 
    $mail->FromName = 'Your From name'; 
    $mail->AddAddress('[email protected]');     
    $mail->IsHTML(true);        
    $mail->Subject = 'Here is the subject';   
    $mail->Body = 'This is the HTML message body <strong>in bold!</strong>';  
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';  
    if(!$mail->Send()) {   
     echo 'Message could not be sent.';   
     echo 'Mailer Error: ' . $mail->ErrorInfo;  
     exit; 
    }  
    echo 'Message has been sent'; 
?> 

我無法找到問題。我還包含了從中獲取class.phpmailer.php文件的phpmailer文件。請幫助...

回答

2

:( Original Answer

GoDaddy has several limitations for its shared-hosting plans.

If you're trying to send emails from the GoDaddy host, you'll need to use the following SMTP server:

relay-hosting.secureserver.net Also, keep in mind that the GoDaddy SMTP servers are very busy, which means it might take some time until your email sent to its recipient.

Don't waste your time and try to configure other SMTP servers (Gmail etc) to handle your outgoing emails. GoDaddy has blocked this option and limited it only to the mentioned server above.

Read here: GoDaddy costumer service answer

如果鏈接仍然是工作......你真幸運

相關問題