2012-07-25 93 views
3

我構建了需要發送電子郵件(低容量)的Intranet應用程序。我將無法使用我的組織的SMTP服務器,所以我需要通過sendmailmail發送這些電子郵件。使用'mail'或'sendmail'發送帶有CodeIgniter的電子郵件

然而,當我配置我的電子郵件爲:

$config['protocol'] = 'sendmail'; 

我得到:

Exit status code: 127 
Unable to open a socket to Sendmail. Please check settings. 
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method. 

,當我使用:

$config['protocol'] = 'mail'; 

我得到:

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method. 

有什麼我應該設置在PHP中或檢查phpinfo()找出如何得到這個工作?

+1

你試過根本就沒有配置什麼?這大多數時候都有效。如果這不起作用,那麼我猜測問題出現在$ config ['mailpath']'變量中。 – Robert 2012-07-25 15:21:37

+0

使用'codeigniter電子郵件設置網站:stackoverflow.com'做一個谷歌搜索,看看現有的任何問題/答案是否有幫助。 – 2012-07-25 15:23:16

+0

我一直在尋找解決方案,但目前爲止沒有具體的東西 - 我只需要發送電子郵件,我發現的一切都建議構建一個可以發送和接收的電子郵件服務器 – pepe 2012-07-25 15:26:11

回答

10

好的 - 這很簡單。

對於任何人誰面臨這個問題:如果安裝的sendmail(實際上後綴)

  1. 首先檢查。我使用的是Ubuntu 11.x.

CD usr/sbin目錄/

  1. 如果你不能找到sendmail的,那麼就需要安裝
sudo apt-get install postfix 
  1. 我接受d對話框上的默認選項,一旦安裝完成,發送的電子郵件沒有問題。
1

在Windows操作系統,我已經嘗試了sendmail類。
你必須把sendmail.exe,sendmail.ini,和另外兩個.dll文件裏面,

C:\ WAMP \ sendmail的

配置sendmail.ini文件按照Gmail服務器:

[sendmail] 

smtp_server=smtp.gmail.com 
smtp_port=587 
smtp_ssl=tls 
error_logfile=error.log 
debug_logfile=debug.log 
[email protected] 
auth_password=mypassword 
hostname=smtp.gmail.com 

然後編輯php.ini文件,可用內

C:\ WAMP \ BIN \ apache的\ Apache2.2.17 \ BIN

sendmail_path="C:\wamp\sendmail\sendmail.exe -t -i" 

現在運行項目,請參閱日誌文件:

C:\ WAMP \ sendmail的\錯誤。登錄 C:\ WAMP \ sendmail的\

的debug.log

我認爲這篇文章可以幫助你..

相關問題