2016-07-13 15 views
2

這是我的代碼,我試過smtp_port 587,465和25。但我無法發送電子郵件。而我的網站是不是SSL,所以我避免SSL://smtp.googlemail.com,而不是我用smtp.googlemail.com,我也試圖與SSL://smtp.googlemail.com無法發送郵件在codigniter 3中的SMPT錯誤

public function email() 
{ 
    $config = Array(
     'protocol' => 'smtp', 
     'smtp_host' => 'smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '******', 
     'smtp_pass' => '******', 
     'mailtype' => 'html', 
     'charset' => 'iso-8859-1' 
    ); 
    $this->load->library('email', $config); 
    $this->email->set_newline("\r\n"); 

    $this->email->from('[email protected]', 'Vizag updates'); 
    $this->email->to('[email protected]'); 
    $this->email->subject('Activation link...! Vizag updates'); 
    $msg = "your activation link <a href='base_url'>click here</a>"; 
    $this->email->message($msg); 
    $this->email->send(); 
    echo $this->email->print_debugger();  
} 

我該如何解決這個問題?你能幫我請我感謝您的寶貴答案

Please click to show my errors

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 

A PHP Error was encountered 

Severity: Notice 

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe 

Filename: libraries/Email.php 

Line Number: 2172 

Backtrace: 
+0

你的形象是非常小的不能讀取錯誤。 – user4419336

+0

現在你可以看到,或使用放大我的圖片 – Siddhu

回答

2

當我得到了錯誤的東西與我的身份驗證是錯誤的。

確保禁用兩步驗證或啓用對不太安全的應用程序的訪問。

This tutorial爲我做了詭計。

希望它可以幫助

+0

我已經嘗試了這@jonas ...但仍然,我面臨錯誤 – Siddhu

+0

@Siddhu你試過設置'smtp_crypto'=>'ssl'? – TrueStory

+0

是的,我試過@jonas。之後,我收到此警告嚴重性:警告 消息:fsockopen():無法連接到ssl://smtp.gmail.com:465(連接被拒絕) 文件名:libraries/Email.php – Siddhu

0

最後,我解決了

我們需要給谷歌的訪問權限 https://support.google.com/accounts/answer/6010255?hl=en

public function send() 
{ 
    $config = Array(
     'protocol' => 'smtp', 
     'smtp_host' => 'ssl://smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '****@gmail.com', 
     'smtp_pass' => '***', 
     'mailtype' => 'html', 
     'charset' => 'iso-8859-1' 
    ); 
    $this->load->library('email', $config); 
    $this->email->set_newline("\r\n"); 
    $this->email->from('[email protected]', 'admin'); 
    $this->email->to('[email protected], [email protected]'); 
    $this->email->subject('Registration Verification:'); 
    $message = "Thanks for signing up! Your account has been created...!"; 
    $this->email->message($message); 
    if (! $this->email->send()) { 
     show_error($this->email->print_debugger()); 
    } 

}