2011-10-20 69 views
1

我試圖通過1and1託管的codeigniter網站上的SMTP發送電子郵件。當我在本地執行它時,它運行良好,但只要從我的1and1主機嘗試它,我會收到錯誤消息。在1and1主機上使用Codeigniter發送SMTP電子郵件

這裏是我的配置:

$config['protocol'] = 'smtp'; 
$config['smtp_host'] = 'auth.smtp.1and1.fr'; //i'm in france and this is the SMTP server adress 1and1 gave me. 
$config['smtp_port'] = 25; 
$config['smtp_user'] = '[email protected]'; 
$config['smtp_pass'] = 'password'; 

,這裏是錯誤:

The following SMTP error was encountered: 110 Connection timed out 
Unable to send data: AUTH LOGIN 
Failed to send AUTH LOGIN command. Error: 
Unable to send data: MAIL FROM: 

from: 

The following SMTP error was encountered: 
Unable to send data: RCPT TO: 

to: 

The following SMTP error was encountered: 
Unable to send data: DATA 

data: 

The following SMTP error was encountered: 
Unable to send data: //details about my message i removed 
Unable to send data: . 

The following SMTP error was encountered: 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. 

然後我試圖使用smtp.1and1.com而不是auth.smtp.1and1.fr。令人驚訝的是,它的工作,但它需要30秒執行! (並在我的本地主機上它是瞬間的)。

有什麼建議嗎?

回答

0

與他們的支持交談。他們可能對港口有限制。或者使用sendmail。

0

如果您的主機服務器和電子郵件服務器位於相同的地方,您不需要進行smtp認證。

所以從你的配置文件中刪除下面的代碼,保留所有默認設置並執行你的功能。爲我工作。在這種情況下應該爲你工作。

$config['protocol'] = 'smtp'; 
$config['smtp_host'] = 'auth.smtp.1and1.fr'; //i'm in france and this is the SMTP server adress 1and1 gave me. 
$config['smtp_port'] = 25; 
$config['smtp_user'] = '[email protected]'; 
$config['smtp_pass'] = 'password';