Php cpanel中的代码点火器smtp不工作
我正在使用cpanel并尝试向多个电子邮件发送电子邮件。 我已经创建了电子邮件帐户并放置了配置,但是当我尝试发送时,出现了很多错误。我希望有人能帮助我Php cpanel中的代码点火器smtp不工作,php,codeigniter,email,smtp,Php,Codeigniter,Email,Smtp,我正在使用cpanel并尝试向多个电子邮件发送电子邮件。 我已经创建了电子邮件帐户并放置了配置,但是当我尝试发送时,出现了很多错误。我希望有人能帮助我 ?php class Notification_model extends CI_Model { public function send_notification_email($link){ $emails = $this->get_all_emails(); $this->load->helper('emai
?php
class Notification_model extends CI_Model {
public function send_notification_email($link){
$emails = $this->get_all_emails();
$this->load->helper('email');
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'lax09.web.com.ph';
$config['smtp_port'] = '465';
$config['smtp_auth'] = true;
$config['smtp_timeout'] = '7';
$config['smtp_user'] = $this->config->item('admin_email');
$config['smtp_pass'] = $this->config->item('admin_pass');
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = "html";
$config['validation'] = TRUE;
$this->email->initialize($config);
$this->email->from($this->config->item('admin_email') , 'Sample Sender');
$this->email->to($emails);
$this->email->subject('Good day');
$message = '
<!DOCTYPE html>
<html lang="en">';
$message .= '<p>Hello Everyone,</p>';
$message .= '<p>We have news for you, just click the link below for details.</p>';
$message .= '<p><a href="'.$link.'">Click here! </a></p>';
$message .= '<p>Thank you,</p>';
$message .= '<p>Sample Sender</p>';
$message .= '</body></html>';
$this->email->message($message);
if ( ! $this->email->send())
{
echo "<pre>".$this->email->print_debugger() ."</pre>";
}
else{
return TRUE;
}
}
public function get_all_emails(){
$query = $this->db->get('accounts');
$emails = array();
foreach($query->result() as $row){
$emails[] = $row->email;
}
return $emails;
}
}
?php
类通知模型扩展了CI模型{
公共功能发送通知电子邮件($link){
$emails=$this->get_all_emails();
$this->load->helper('email');
$this->load->library('email');
$config['protocol']='smtp';
$config['smtp_host']='lax09.web.com.ph';
$config['smtp_port']='465';
$config['smtp_auth']=true;
$config['smtp_timeout']='7';
$config['smtp_user']=$this->config->item('admin_email');
$config['smtp_pass']=$this->config->item('admin_pass');
$config['charset']='utf-8';
$config['newline']=“\r\n”;
$config['mailtype']=“html”;
$config['validation']=TRUE;
$this->email->initialize($config);
$this->email->from($this->config->item('admin_email'),'Sample Sender');
$this->email->to($email);
$this->email->subject('Good day');
$message='1
';
$message.='大家好,';
$message.='我们有消息要告诉您,只需单击下面的链接了解详细信息。;
$message.='';
$message.='谢谢你,';
$message.='示例发送者';
$message.='';
$this->email->message($message);
如果(!$this->email->send())
{
回显“$this->email->print_debugger()”;
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: errno
Filename: libraries/Email.php
Line Number: 1687
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: errstr
Filename: libraries/Email.php
Line Number: 1688
The following SMTP error was encountered:
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 email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Tue, 9 Feb 2016 14:05:50 +0800
From: "Sample Sender" <project@sample.ph>
Return-Path: <project@sample.ph>
To: aa@gmail.com, bb@g.com, cc@gm.com, dd@yahoo.com, ee@gmail.com, asdsa@g.com, ff@gmail.com
Subject: =?utf-8?Q?Good_day_bamboo_lovers?=
Reply-To: "project@sample.ph" <project@sample.ph>
X-Sender: project@sample.ph
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <56b981be02aa6@sample.ph>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_56b981be02ae7"
This is a multi-part message in MIME format.
Your email application may not support this format.
}
否则{
返回TRUE;
}
}
公共功能获取所有电子邮件(){
$query=$this->db->get('accounts');
$emails=array();
foreach($query->result()作为$row){
$emails[]=$row->email;
}
返回$E电子邮件;
}
}
这里有一些错误
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('FROM email id', 'send email');
$this->email->to('TO email id');
$this->email->subject('Subject');
$this->email->message('message of body');
$st = $this->email->send();
print_r($this->email->print_debugger());
遇到PHP错误
严重性:通知
消息:未定义变量:errno
文件名:libraries/Email.php
电话号码:1687
遇到一个PHP错误
严重性:通知
消息:未定义变量:errstr
文件名:libraries/Email.php
行号:1688
遇到以下SMTP错误:
无法发送数据:身份验证登录
无法发送AUTH LOGIN命令。错误:
无法发送数据:邮件发件人:
发件人:
遇到以下SMTP错误:
无法将数据:RCPT发送到:
致:
遇到以下SMTP错误:
无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。
用户代理:CodeIgniter
日期:2016年2月9日星期二14:05:50+0800
发件人:“样本发送者”
返回路径:
致:aa@gmail.com, bb@g.com, cc@gm.com, dd@yahoo.com, ee@gmail.com, asdsa@g.com, ff@gmail.com
主题:=?utf-8?Q?祝你生日快乐?竹子爱好者们=
答复:project@sample.ph"
X-Sender:project@sample.ph
X-Mailer:CodeIgniter
X优先级:3(正常)
消息ID:
Mime版本:1.0
内容类型:多部分/备选;boundary=“B_ALT_56b981be02ae7”
这是MIME格式的多部分消息。
您的电子邮件应用程序可能不支持此格式。
试试看
试试看
public函数发送邮件($to、$subject、$message){
/*邮件配置-仅在此处使用*/
$config=array('protocol'=>'mail',
'wordwrap'=>FALSE,
“邮件类型”=>“html”,
“字符集”=>“utf-8”,
'crlf'=>“\r\n”,
'换行符'=>“\r\n”,
“发送多部分”=>错误
);
$this->load->library('email',$config);
$CompanyName=“域名”;
$setmail=”support@Domainname.com";
$this->email->from($setmail,$CompanyName);
$this->email->to$to;
$this->email->subject($subject);
$this->email->message($message);
返回$this->email->send();
}
public函数发送邮件($to、$subject、$message){
/*邮件配置-仅在此处使用*/
$config=array('protocol'=>'mail',
'wordwrap'=>FALSE,
“邮件类型”=>“html”,
“字符集”=>“utf-8”,
'crlf'=>“\r\n”,
'换行符'=>“\r\n”,
“发送多部分”=>错误
);
$this->load->library('email',$config);
$CompanyName=“域名”;
$setmail=”support@Domainname.com";
$this->email->from($setmail,$CompanyName);
$this->email->to$to;
$this->email->subject($subject);
$this->email->message($message);
返回$this->email->send();
}
这个主机是什么$config['smtp_host']='lax09.web.com.ph'代码>?来自电子邮件配置。有一个是无担保的;mail.domain.com和端口587在SSAME配置中使用sendmail,但协议是sendmail?我使用的smtp btw587端口不是不安全的。它使用TLS协议。尝试将ssl://
作为ssl://lax09.web.com.ph
。此主机是什么$config['smtp_host']='lax09.web.com.ph'代码>?来自电子邮件配置。有一个是无担保的;mail.domain.com和端口587在SSAME配置中使用sendmail,但协议是sendmail?我使用的smtp btw587端口不是不安全的。它使用TLS协议。尝试将ssl://
作为ssl://lax09.web.com.ph
。