无法使用PHP SMTP发送电子邮件.您的服务器可能未配置为使用此方法发送邮件 [英] Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method
本文介绍了无法使用PHP SMTP发送电子邮件.您的服务器可能未配置为使用此方法发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用codeigniter
Iam using codeigniter
我取消了实时服务器上的代码. 使用print_debugger()得到以下错误
I exicuted the code on live server. got the following error using print_debugger()
无法使用PHP SMTP发送电子邮件.您的服务器可能不是 配置为使用此方法发送邮件.
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
public function sendEnquiry() {
$this->load->library('email');
$name = $this->input->post("fname");
$cemail = $this->input->post("email");
$pno = $this->input->post("phone");
$message = $this->input->post("message");
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://mail.gatewaykhobar.com';
$config['smtp_port'] = '465';
$config['smtp_timeout'] = '7';
$config['smtp_user'] = '***********';
$config['smtp_pass'] = '***********';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'text'; // or html
$config['validation'] = FALSE;
$this->email->initialize($config);
$this->email->from('info@gatewaykhobar.com','Gateway Restaurent Contact');
$this->email->to($cemail);
$this->email->subject('Gateway Restaurent Contact Enquiry');
$this->email->message($message);
$send = $this->email->send();
if($send) {
echo json_encode("send");
} else {
$error = $this->email->print_debugger(array('headers'));
echo json_encode($error);
}
}
推荐答案
将smtp_port从465更改为587 确保$ config ['newline'] ="\ r \ n";用双引号而不是单引号
Change smtp_port from 465 to 587 Make sure $config['newline'] = "\r\n"; is in double quotes not single quotes
这篇关于无法使用PHP SMTP发送电子邮件.您的服务器可能未配置为使用此方法发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文