简体   繁体   English

Canot使用Codeigniter使用Mailgun SMTP发送邮件

[英]Canot send mail with mailgun smtp using codeigniter

I'm trying to send an email using codeigniter email library and mailgun smtp. 我正在尝试使用codeigniter电子邮件库和mailgun smtp发送电子邮件。 The smtp settings are configured corectly and i don't know what could be the problem.... smtp设置是完全配置的,我不知道可能是什么问题...。

here is the php code: 这是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();

I've got the following errors: 我遇到以下错误:

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--

By checking Mailgun's documentation : 通过检查Mailgun的文档

Most often, this is caused by internet service providers (“ISP”) blocking port #25. 通常,这是由Internet服务提供商(ISP)阻塞端口#25引起的。 This tends to happen if you are using a residential ISP. 如果您使用的是住宅ISP,则往往会发生这种情况。

To check this, try running telnet in command line: 要检查这一点,请尝试在命令行中运行telnet:

telnet smtp.mailgun.org 25

If port 25 is not blocked, you should see something like this: 如果端口25没有被阻塞,您应该看到类似以下内容:

Trying 174.37.214.195...
Connected to mxa.mailgun.org.
Escape character is '^]'.
220 mxa.mailgun.org (Mailgun)

If you don't see this, then you are being blocked. 如果您没有看到此消息,则说明您已被阻止。 There are a couple workarounds: 有几种解决方法:

  1. Send using the HTTP API 使用HTTP API发送
  2. Try using port #587 or #2525 尝试使用端口#587或#2525

The problem was my shared hosting provider. 问题是我的共享主机提供商。 Seams that they dont accept connections to external smtp mail providers. 表示他们不接受与外部smtp邮件提供商的连接。 However I will accept sotoz answer as I will send them using http api ! 但是,我将接受sotoz答案,因为我将使用http api将它们发送给我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用mailgun SMTP在我的codeigniter应用程序中发送电子邮件 - Unable to send emails in my codeigniter application using mailgun SMTP 无法使用 mailgun 发送邮件 - cannot send mail using mailgun Html 邮件无法使用 CodeIgniter SMTP 发送 - Html mail can't send using CodeIgniter SMTP 使用 Sendgrid API 密钥而不是 Codeigniter 中的 SMTP 发送邮件 - Send mail using Sendgrid API key not with SMTP in Codeigniter 发送邮件的SMTP协议不能与codeigniter一起使用 - SMTP protocol to send mail is not working with codeigniter Codeigniter 在本地主机上使用 gmail smtp 发送邮件 - Codeigniter send mail with gmail smtp on localhost 如何使用 mailgun API 在 php 中发送邮件 - How to send mail in php using mailgun API php 邮件使用 mailgun smtp 被 gmail 阻止; 错误 RFC 5322 - php mail using mailgun smtp blocked by gmail; error RFC 5322 Codeigniter 3 无法使用 PHP ZC2239A92BDE29F0A00F9173193CC2FE 发送 email。 您的服务器可能未配置为使用此方法发送邮件 - Codeigniter 3 Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method Codeigniter:您的服务器可能未配置为使用此方法发送邮件。 无法使用 PHP SMTP 发送电子邮件 - Codeigniter: Your server might not be configured to send mail using this method. Unable to send email using PHP SMTP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM