【问题标题】:Send Email with codeigniter(configuration) from my own server从我自己的服务器发送带有 codeigniter(配置)的电子邮件
【发布时间】:2013-07-11 06:41:20
【问题描述】:

过去我已经通过 google smtp 发送电子邮件,现在我想从我自己的服务器发送电子邮件。

我已关注this example 来设置我的电子邮件配置文件。这就是我的 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 =

【问题讨论】:

  • 当您尝试从本地服务器发送电子邮件时会发生这种情况。

标签: php codeigniter email smtp


【解决方案1】:

您可能需要检查您的邮件服务器日志。这些应该告诉您邮件服务器是否甚至从您的脚本接收到消息以进行排队 - 如果是,当它尝试将消息传递到远程 MTA 时会发生什么。

【讨论】:

  • 对于 1and1,我意识到共享主机的 SMTP 端口不是 25 而是 465。如果您使用 1and1,这可能会对您有所帮助。如果没有,请确保您的服务器的所有详细信息都正确无误。
【解决方案2】:

你要寄到哪里?尝试发送到您的其他电子邮件。我知道我在使用 Google 应用程序时遇到了发送到同一域的问题。

尝试将其发送到 hotmail 或 yahoo。

【讨论】:

    猜你喜欢
    • 2015-10-28
    • 2016-06-28
    • 2020-09-12
    • 1970-01-01
    • 2019-10-10
    • 1970-01-01
    • 2013-11-21
    • 2014-12-18
    • 2018-09-08
    相关资源
    最近更新 更多