无法使用codeigniter使用mailgun smtp发送邮件
Canot send mail with mailgun smtp using codeigniter
我正在尝试使用 codeigniter 电子邮件库和 mailgun smtp 发送电子邮件。
smtp 设置正确配置,我不知道可能是什么问题....
这里是 php 代码:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.mailgun.org';
$config['smtp_port'] = 25;
$config['smtp_user'] = 'user@user.com';
$config['smtp_pass'] = 'thepasswordconfiguredinmailgun';
$config['smtp_timeout'] = '4';
$config['crlf'] = '\n';
$config['newline'] = '\r\n';
$this->email->initialize($config);
$this->email->clear(TRUE);
$this->email->from('office@test.com', 'FromName');
$this->email->to('myemail@yahoo.com');
$this->email->subject('Subiect de test');
$this->email->message('Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?');
$this->email->send();
echo $this->email->print_debugger();
我遇到了以下错误:
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Fri, 13 May 2016 10:19:19 +0300 From: "PADigest" Return-Path: To: test123@yahoo.com Subject: =?utf-8?Q?Subiect_de_test?= Reply-To: "office@padiads.ro" X-Sender: office@padigest.ro X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <57357ff767c94@padiads.ro> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_57357ff767d02" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_57357ff767d02 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ? --B_ALT_57357ff767d02 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ? --B_ALT_57357ff767d02--
Unable to send data: .
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Fri, 13 May 2016 10:19:19 +0300
From: "PADigest" <office@padiast.ro>
Return-Path: <office@padiasr.ro>
To: test124@yahoo.com
Subject: =?utf-8?Q?Subiect_de_test?=
Reply-To: "office@padiast.ro" <office@padiast.ro>
X-Sender: office@padiast.ro
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <57357ff767c94@padigest.ro>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_57357ff767d02"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_57357ff767d02
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?
--B_ALT_57357ff767d02
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?
--B_ALT_57357ff767d02--
通过检查 Mailgun's documentation:
大多数情况下,这是由互联网服务提供商(“ISP”)阻止端口 #25 造成的。如果您使用的是住宅 ISP,则往往会发生这种情况。
要检查这一点,请在命令行中尝试 运行 telnet:
telnet smtp.mailgun.org 25
如果端口 25 未被阻止,您应该会看到如下内容:
Trying 174.37.214.195...
Connected to mxa.mailgun.org.
Escape character is '^]'.
220 mxa.mailgun.org (Mailgun)
如果你没有看到这个,那你就被屏蔽了。有几个解决方法:
- 使用 HTTP 发送 API
- 尝试使用端口 #587 或 #2525
问题是我的共享托管服务提供商。他们不接受与外部 smtp 邮件提供商的连接。但是我会接受 sotoz 的回答,因为我会使用 http api !
发送给他们
我正在尝试使用 codeigniter 电子邮件库和 mailgun smtp 发送电子邮件。 smtp 设置正确配置,我不知道可能是什么问题....
这里是 php 代码:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.mailgun.org';
$config['smtp_port'] = 25;
$config['smtp_user'] = 'user@user.com';
$config['smtp_pass'] = 'thepasswordconfiguredinmailgun';
$config['smtp_timeout'] = '4';
$config['crlf'] = '\n';
$config['newline'] = '\r\n';
$this->email->initialize($config);
$this->email->clear(TRUE);
$this->email->from('office@test.com', 'FromName');
$this->email->to('myemail@yahoo.com');
$this->email->subject('Subiect de test');
$this->email->message('Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?');
$this->email->send();
echo $this->email->print_debugger();
我遇到了以下错误:
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter Date: Fri, 13 May 2016 10:19:19 +0300 From: "PADigest" Return-Path: To: test123@yahoo.com Subject: =?utf-8?Q?Subiect_de_test?= Reply-To: "office@padiads.ro" X-Sender: office@padigest.ro X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <57357ff767c94@padiads.ro> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_57357ff767d02" This is a multi-part message in MIME format. Your email application may not support this format. --B_ALT_57357ff767d02 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ? --B_ALT_57357ff767d02 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ? --B_ALT_57357ff767d02--
Unable to send data: .
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Fri, 13 May 2016 10:19:19 +0300
From: "PADigest" <office@padiast.ro>
Return-Path: <office@padiasr.ro>
To: test124@yahoo.com
Subject: =?utf-8?Q?Subiect_de_test?=
Reply-To: "office@padiast.ro" <office@padiast.ro>
X-Sender: office@padiast.ro
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <57357ff767c94@padigest.ro>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_57357ff767d02"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_57357ff767d02
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?
--B_ALT_57357ff767d02
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Testez sa vad daca merge si daca pot sa trimit. Daca nu pot de ce nu pot ?
--B_ALT_57357ff767d02--
通过检查 Mailgun's documentation:
大多数情况下,这是由互联网服务提供商(“ISP”)阻止端口 #25 造成的。如果您使用的是住宅 ISP,则往往会发生这种情况。
要检查这一点,请在命令行中尝试 运行 telnet:
telnet smtp.mailgun.org 25
如果端口 25 未被阻止,您应该会看到如下内容:
Trying 174.37.214.195...
Connected to mxa.mailgun.org.
Escape character is '^]'.
220 mxa.mailgun.org (Mailgun)
如果你没有看到这个,那你就被屏蔽了。有几个解决方法:
- 使用 HTTP 发送 API
- 尝试使用端口 #587 或 #2525
问题是我的共享托管服务提供商。他们不接受与外部 smtp 邮件提供商的连接。但是我会接受 sotoz 的回答,因为我会使用 http api !
发送给他们