我在Codeigniter中使用php邮件程序。 这是我的电子邮件设置 邮件正在发送到其他电子邮件ID,但没有发送到办公室365中的电子邮件ID。
<?php defined('BASEPATH') OR exit('No direct script access allowed.');
$config['useragent'] = 'PHPMailer'; // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol'] = 'smtp'; // 'mail', 'sendmail', or 'smtp'
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = 'example@example.com';
$config['smtp_pass'] = 'password';
//$config['smtp_port'] = 587;
$config['smtp_timeout'] = 5; // (in seconds)
$config['smtp_crypto'] = 'tls'; // '' or 'tls' or 'ssl'
$config['smtp_debug'] = 4; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['wordwrap'] = true;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html'; // 'text' or 'html'
$config['charset'] = 'ISO-8859-15'; // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site.
$config['validate'] = true;
$config['priority'] = 3; // 1, 2, 3, 4, 5; on PHPMailer useragent NULL is a possible option, it means that X-priority header is not set at all, see https://github.com/PHPMailer/PHPMailer/issues/449
$config['crlf'] = "\n"; // "\r\n" or "\n" or "\r"
$config['newline'] = "\n"; // "\r\n" or "\n" or "\r"
$config['bcc_batch_mode'] = false;
$config['bcc_batch_size'] = 200;
$config['encoding'] = '8bit'; // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'.
我有以下错误
Connection: opening to smtp.office365.com:25, timeout=5, options=array ( ) 2016-01-02 10:00:49 SMTP ERROR: Failed to connect to server: Connection refused (111) 2016-01-02 10:00:49 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting bool(false)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
相同的设置在其他服务器中工作,但在Go daddy服务器中不起作用。 我检查了openssl连接已启用。
答案 0 :(得分:0)
这个问题有很多重复,PHPMailer文档也说明了这一点:GoDaddy阻止出站电子邮件,所以你必须使用他们的邮件服务器。