沃梦达 / 编程问答 / php问题 / 正文

codeigniter localhost 电子邮件未发送

codeigniter localhost email not sending(codeigniter localhost 电子邮件未发送)

本文介绍了codeigniter localhost 电子邮件未发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,我不明白.这是我的代码

I have some problem and I don't understand. This is my code

$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;


$this->email->initialize($config);

$this->email->from('rudzstyle@yahoo.co.id', 'Your Name');
$this->email->to('rudzstyle@gmail.com');
$message = $data->nama_depan.'<br>'.$this->input->post('snk');
$this->email->subject($message);
$this->email->message('Testing the email class.');

$this->email->send();

echo $this->email->print_debugger();

这 2 封电子邮件是活动电子邮件.

that 2 email are active email.

调试器的结果是这样的

退出状态码:1 无法打开到 Sendmail 的套接字.请检查设置.无法使用 PHP Sendmail 发送电子邮件.您的服务器可能未配置为使用此方法发送邮件.

Exit status code: 1 Unable to open a socket to Sendmail. Please check settings. Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.

用户代理:CodeIgniter 日期:2014 年 6 月 2 日星期一 07:53:21 +0200 来自:你的名字"返回路径:收件人:rudzstyle@gmail.com 主题:=?iso-8859-1?Q?Riyanto 测试?==?iso-8859-1?Q??= 回复:rudzstyle@yahoo.co.id" X-Sender:rudzstyle@yahoo.co.id X-Mailer:CodeIgniter X-Priority:3(正常)消息 ID:<538c1151179cb@yahoo.co.id> Mime 版本:1.0

User-Agent: CodeIgniter Date: Mon, 2 Jun 2014 07:53:21 +0200 From: "Your Name" Return-Path: To: rudzstyle@gmail.com Subject: =?iso-8859-1?Q?Riyanto test?= =?iso-8859-1?Q??= Reply-To: "rudzstyle@yahoo.co.id" X-Sender: rudzstyle@yahoo.co.id X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <538c1151179cb@yahoo.co.id> Mime-Version: 1.0

内容类型:文本/纯文本;字符集=iso-8859-1内容传输编码:8bit

Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit

测试电子邮件类.

推荐答案

在 Codeigniter 中,试试这个

In Codeigniter, Try this

$this->load->library('email');
$config['protocol']='smtp';
$config['smtp_host']='your host';
$config['smtp_port']='465';
$config['smtp_timeout']='30';
$config['smtp_user']='your mail id';
$config['smtp_pass']='your password';
$config['charset']='utf-8';
$config['newline']="
";
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from('no-reply@your-site.com', 'Site name');
$this->email->to('to-address-mail-id');
$this->email->subject('Notification Mail');
$this->email->message('Your message');
$this->email->send();

$config['smtp_user'] 字段中,提供您的 email_id 并在 $config['smtp_pass'] 字段中,提供该邮件的密码.

In $config['smtp_user'] field,give your email_id and in $config['smtp_pass'] field,provide your password for that mail.

这行得通.试试吧.希望这能解决您的问题.

This will work.Just try it. Hope this will solve your problem.

这篇关于codeigniter localhost 电子邮件未发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:codeigniter localhost 电子邮件未发送

基础教程推荐