2016-04-14 56 views
1

我有問題發送郵件使用wamp server。我得到這個錯誤電子郵件:發送郵件使用Gmail,笨,WAMP本地主機

220 smtp.gmail.com ESMTP s10sm40910411wjp.3 - gsmtp 
hello: 250-smtp.gmail.com at your service, [151.232.116.37] 
250-SIZE 35882577 
250-8BITMIME 
250-STARTTLS 
250-ENHANCEDSTATUSCODES 
250-PIPELINING 
250-CHUNKING 
250 SMTPUTF8 
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. s10sm40910411wjp.3 - gsmtp 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method. 

這是codeigniter contoller

class SendEmail extends CI_Controller{ 
public function index(){ 

    $config=array(); 
    $config['protocol' ] = 'smtp'       ; 
    $config['smtp_host'] = 'smtp.gmail.com'    ; 
    $config['smtp_port'] = 465       ; 
    $config['smtp_user'] = '[email protected]' ; 
    $config['smtp_pass'] = 'pass'   ; 
    $config['charset' ] = 'utf-8'      ; 
    $config['wordwrap' ] = TRUE       ; 
    $config['validate'] = TRUE       ; 
    $config['_smtp_auth'] = TRUE       ; 
    $config['smtp_crypto'] = 'ssl'       ; 

    $this->load->library('email'); 
    $this->email->initialize($config); 
    $this->email->from('[email protected]', 'test'); 
    $this->email->to('[email protected]'); 
    $this->email->subject("This is Another Email test mail"); 
    $this->email->message("This is email is test for you mr me!the god is more than..."); 
    if($this->email->send()){ 
     echo 'You Are Luck!'; 
    } 
    else{ 
     echo $this->email->print_debugger(); 
    } 
} 

現在我不t知道問題是由gmail或我的wamp localhost,這是配置wamp服務器php.inisendmail.ini(我下載
sendmail.zip文件並將其解壓到wamp64 \ sendmai L)。它是我的php.inisendmail.ini配置

php.ini file: 
smtp_port = 465 
sendmail_path = "\ "D:\wamp64\sendmail\sendmail.exe\" -t" 

而且

sendmail.ini file: 
[email protected] 
auth_password=test 
smtp_server= smtp.gmail.com 
smtp_port= 465 

回答

1

您可能忘記啓用IMAP(這也使您的Gmail帳戶SMTP)訪問。

+0

我啓用Gmail的IMAP,但得到這個錯誤再次@克里斯 – mrme

0

Google可能會阻止某些未使用現代安全標準的應用或設備的登錄嘗試。

不夠安全的應用更改帳戶訪問: https://www.google.com/settings/security/lesssecureapps

+0

我啓用它。但沒有effect.'Failed驗證密碼。錯誤:535-5.7.8未接受用戶名和密碼「@Ahmad Faizal – mrme

+0

@mrme是你的問題解決?我實際上正面臨着同樣的問題。 我啓用了對安全性較低的應用的帳戶訪問權限,但仍無法使用 – BoCyrill

相關問題