2016-01-02 107 views
0

我使用PHP的郵件在笨。 這裏是我的電子郵件設置 郵件被髮送到其他電子郵件ID而不是發送給電子郵件ID是在辦公室365笨PHPMailer的電子郵件不發送到Office 365帳戶

<?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']  = '[email protected]'; 
$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 

相同的設置正在在其他服務器上,而不是在去爸爸服務器的工作。 我檢查OpenSSL的連接被啓用。

+0

的可能的複製[使用上GoDaddy的託管的PHPMailer發送電子郵件(http://stackoverflow.com/questions/18858400/send-email-using-phpmailer-on-godaddy-hosting) – Synchro

回答

0

這個問題有很多重複的地方,它也包含在PHPMailer文檔中:GoDaddy阻止出站郵件,所以你必須使用他們的郵件服務器。