2012-02-10 130 views
0

要發送的電子郵件,我已經設置了配置如下發送電子郵件的笨

$config['protocol'] = 'smtp'; 
$config['charset'] = 'iso-8859-1'; 
$config['wordwrap'] = TRUE; 

$this->email->subject('Email Test'); 
$this->email->message('Testing the email class.'); 

$this->email->send(); 

我的Outlook電子郵件帳戶的SMTP設置爲

mail.mycompany.com 

我有錯誤發送電子郵件從這個帳戶到任何其他帳戶。我忘記了錯誤信息,現在我無法在這臺計算機上覆制它,但是看看這些配置,你認爲它是正確的嗎? (在調用函數發送以發送電子郵件之前,我還包括對其初始化程序的調用或加載其庫以便在控制器構造函數中使用)。

+0

你配置看起來很棒。無論你的問題是什麼,你應該總是添加錯誤信息,否則沒有人能夠幫助你,如果它不是很明顯。 – hakre 2012-02-10 17:20:52

+0

你在配置文件中有SMTP服務器,用戶名和密碼,對吧? – 2012-02-10 17:22:44

+0

您是否在Mamp或Wamp中脫機? – bottleboot 2012-02-10 17:41:46

回答

1

OK,儘量使用協議的sendmail

$config['protocol'] = 'sendmail'; 
$config['mailpath'] = '/usr/sbin/sendmail'; 
$config['charset'] = 'iso-8859-1'; 
$config['wordwrap'] = TRUE; 

$this->email->initialize($config); 

如果您使用SMTP協議,您需要定義什麼是您的SMTP PARAMS:

$config['smtp_host']  
$config['smtp_user']  
$config['smtp_pass']  

然後

$this->email->subject('Email Test'); 
$this->email->message('Testing the email class.'); 

$this->email->send(); 

echo $this->email->print_debugger();