过去我已经通过 google smtp 发送电子邮件,现在我想从我自己的服务器发送电子邮件。
我已按照此示例设置我的电子邮件配置文件。这就是我的 email.php 文件的样子:
$config['useragent'] = 'CodeIgniter';
$config['protocol'] = 'mail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'localhost';
$config['smtp_user'] = 'noreply@publish.mmedija.com';
$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)的电子邮件帐户(noreply@publish.mmedija.com)。这是我必须在配置文件中设置的 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: "noreply@publish.mmedija.com"
X-Sender: noreply@publish.mmedija.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <51de525d9d15a@publish.mmedija.com>
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
但是我没有收到邮件。此外,调试器中的“回复”字段也不是我设置的发送邮件的字段。也许我在 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 = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =