2013-04-06 36 views
1

我使用笨和電子郵件類試穿MAMP發送電子郵件(免費版)笨發送電子郵件的甲基苯丙胺

我的代碼如下

$config = Array(

 'protocol' => 'smtp', 
     'smtp_host' => 'ssl://smtp.googlemail.com', 
     'smtp_port' => 465, 
     'smtp_user' => '[email protected]', 
     'smtp_pass' => '*********', 
     'mailtype' => 'html', 
     'starttls' => true 
    ); 

    $this->load->library('email', $config); 
    $this->email->set_newline("\r\n"); 

    $this->email->from('[email protected]', 'Jeffrey Way'); 
    $this->email->to('[email protected]');  
    $this->email->subject('This is an email test');  
    $this->email->message('It is working. Great!'); 
    $this->email->send(); 
    echo $this->email->print_debugger(); 

不過,我總是得到一個錯誤

220 mx.google.com ESMTP ri1sm17015935pbc.16 - gsmtp hello: 250-mx.google.com at your service, [203.116.128.34] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 250 ENHANCEDSTATUSCODES

Failed to authenticate password. Error: 535-5.7.1 Username and Password not accepted. Learn more at 535 5.7.1 http://support.google.com/mail/bin/answer.py?answer=14257 ri1sm17015935pbc.16 - gsmtp from: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 ri1sm17015935pbc.16 - gsmtp

The following SMTP error was encountered: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 ri1sm17015935pbc.16 - gsmtp to: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 ri1sm17015935pbc.16 - gsmtp

在此先感謝您的幫助。

回答

0
Authentication Required. 

您使用的不是自己的Gmail帳戶(電子郵件地址和密碼)

+0

嗯都能跟得上我的帳戶用戶名和密碼正確 – edelweiss 2013-04-06 13:19:42

+0

@edelweiss你正在使用的服務器端口是什麼? – sbaaaang 2013-04-06 13:23:42

0

我已經看到了這個問題在許多地方問,當然,我在這裏,因爲我有同樣的問題。我認爲發生的事情是,當Jeffrey Way在2009年編寫教程(Day 3,我的代碼來自我的代碼)時,發送電子郵件的身份驗證非常簡單。我認爲現在與谷歌有所不同。你必須使用oauth2認證流程。我已經設法爲CodeIgniter找到了這樣的代碼,並且可以進行身份​​驗證,但是我仍然不太明白認證後該怎麼做。我可能還沒努力嘗試,因爲後來我一直在爲Google,Yahoo,Facebook,Twitter和Flickr編寫幾個oAuth2身份驗證腳本。我猜測,在允許應用程序訪問您的Google信息後,回調頁面就是您放置實際的sendmail代碼(您的問題中包含的代碼)的位置。所以,我認爲這是一個過程分爲兩個部分:

  1. 驗證到谷歌使用的OAuth2和
  2. 你的終點是發送電子郵件(從路教程你上面的示例代碼)回調頁面。

你只是想簡單地發送電子郵件,我意識到,我也如此。但我認爲你可能想複製粘貼& &試試這個工作腳本:

Login with google account in codeigniter