過去我已經通過谷歌smtp發送電子郵件,現在我想從我自己的服務器發送電子郵件。從我自己的服務器發送帶codeigniter(配置)的電子郵件
我按照this example來設置我的電子郵件配置文件。這是我的email.php文件的樣子:
$config['useragent'] = 'CodeIgniter';
$config['protocol'] = 'mail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'localhost';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'testtest';
$config['smtp_port'] = 25;
$config['smtp_timeout'] = 5;
$config['wordwrap'] = TRUE;
$config['wrapchars'] = 76;
$config['mailtype'] = 'text';
$config['charset'] = 'utf-8';
$config['validate'] = FALSE;
$config['priority'] = 3;
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;
我有一個Apache服務器。我有DirectAdmin軟件,我已經使用它設置了一個帶密碼(testtest)的電子郵件帳戶([email protected])。這是我必須在配置文件中設置的stmp_user和smtp_pass。
令人奇怪的是,這是因爲:
$this->email->send()
返回true,但不發送電子郵件。 print_debugger返回此結果:
Your message has been successfully sent using the following protocol: mail
User-Agent: CodeIgniter
Date: Thu, 11 Jul 2013 08:36:13 +0200
From: "Publishwall.si"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Publishwall.si_-_Aktivacija_ra=c4=8duna?=
test
但我還沒有收到電子郵件。此外,調試器中的「Reply-To」字段不是我設置用來發送郵件的字段。也許有什麼毛病我的配置在php.ini:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
當您嘗試從本地服務器發送電子郵件時會發生這種情況。 –