Php Codeigniter的邮件内容始终包装
我不知道我的代码哪一部分出错了,我打算在codeigniter中以HTML格式发送邮件,但我的邮件总是用76个字符包装,尽管我已经将word wrap设置为false 这是我的密码:Php Codeigniter的邮件内容始终包装,php,html,codeigniter,sendmail,Php,Html,Codeigniter,Sendmail,我不知道我的代码哪一部分出错了,我打算在codeigniter中以HTML格式发送邮件,但我的邮件总是用76个字符包装,尽管我已经将word wrap设置为false 这是我的密码: $content = "<html>"; $content .= "Dear GA,<br/><br/>"; $content .= "You have request for Car use, below is the detail data
$content = "<html>";
$content .= "Dear GA,<br/><br/>";
$content .= "You have request for Car use, below is the detail data :<br/>";
$content .= "<b>Request No :</b> ".$reqno."<br/>";
$content .= "<b>Date :</b> ".$date."<br/>";
$content .= "<b>Time :</b> ".$time."<br/>";
$content .= "<b>Destination :</b> ".$dest."<br />";
$content .= "<b>Passenger :</b> (".$jml.") ".$pasr."<br />";
$content .= "<br /><br /><br /><i style='color:grey'>Send By WIS System Automatic Mail</i></html>";
$ci = get_instance();
$ci->load->library('email');
$ci->email->set_mailtype("html");
$ci->email->set_wordwrap(FALSE);
$ci->email->from('noreply@chingluh.co.id', 'WIS System');
$ci->email->to('mymail@mycompany.co.id');
$ci->email->subject('Car Request');
$ci->email->message($content);
if ($this->email->send()) {
echo 'Email sent.';
}
else{
show_error($this->email->print_debugger());
}
$content=”“;
$content.=“亲爱的GA,
”;
$content.=“您有用车申请,以下是详细数据:
”;
$content.=“请求编号:”$reqno.“
”;
$content.=“日期:”.$Date.“
”;
$content.=“时间:”.$Time.“
”;
$content.=“目的地:”..$dest.“
”;
$content.=“乘客:(“$jml”)”、“$pasr。”
”;
$content.=“通过WIS系统自动邮件发送”;
$ci=get_instance();
$ci->load->library('email');
$ci->email->set_mailtype(“html”);
$ci->email->set_wordwrap(FALSE);
$ci->email->from($ci)noreply@chingluh.co.id","智慧系统",;
$ci->电子邮件->收件人mymail@mycompany.co.id');
$ci->email->subject('carrequest');
$ci->email->message($content);
如果($this->email->send()){
回显“已发送电子邮件”;
}
否则{
显示_错误($this->email->print_debugger());
}
但是html源代码结果总是这样(用等号包装)
亲爱的GA,
您有用车申请,以下是详细信息=
ata:
请求编号:C15L020
日期:2015-12-11
=
ime:10:00
目的地:雅加达
乘客:(2)=
)WIS发送的乘客姓名=
系统自动邮件
谁能给我一个建议,我该怎么办
在此之前谢谢您请包含此代码我不确定,但请尝试
$ci->email->subject('Car Request');
$ci->$email->IsHTML(true);
试试这个:
$this->load->library('email');
$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['wordwrap'] = FALSE;
//your SMTP settings
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'exchange.example.com'; //ssl://
$config['smtp_user'] = 'email@example.com';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = 25;
$this->email->set_newline( "\r\n" );
$this->email->set_crlf( "\r\n" );
$this->email->initialize( $config );
$this->email->clear();
//
$content = "<html>";
$content .= "Dear GA,<br/><br/>";
$content .= "You have request for Car use, below is the detail data :<br/>";
$content .= "<b>Request No :</b> ".$reqno."<br/>";
$content .= "<b>Date :</b> ".$date."<br/>";
$content .= "<b>Time :</b> ".$time."<br/>";
$content .= "<b>Destination :</b> ".$dest."<br />";
$content .= "<b>Passenger :</b> (".$jml.") ".$pasr."<br />";
$content .= "<br /><br /><br /><i style='color:grey'>Send By WIS System Automatic Mail</i></html>";
$this->email->from( $frome, $fromn );
$this->email->to( $email );
$this->email->subject( $subject );
$this->email->message( $content);
$this->email->send();
$this->load->library('email');
$config['charset']='utf-8';
$config['mailtype']='html';
$config['wordwrap']=FALSE;
//您的SMTP设置
$config['protocol']='smtp';
$config['smtp_host']='exchange.example.com'//ssl://
$config['smtp_用户']='email@example.com';
$config['smtp_pass']='password';
$config['smtp_port']=25;
$this->email->set_newline(“\r\n”);
$this->email->set\u crlf(“\r\n”);
$this->email->initialize($config);
$this->email->clear();
//
$content=“”;
$content.=“亲爱的GA,
”;
$content.=“您有用车申请,以下是详细数据:
”;
$content.=“请求编号:”$reqno.“
”;
$content.=“日期:”.$Date.“
”;
$content.=“时间:”.$Time.“
”;
$content.=“目的地:”..$dest.“
”;
$content.=“乘客:(“$jml”)”、“$pasr。”
”;
$content.=“通过WIS系统自动邮件发送”;
$this->email->from($frome,$fromn);
$this->email->to($email);
$this->email->subject($subject);
$this->email->message($content);
$this->email->send();
这是一篇老文章,但可以帮助其他人。我看不到您的配置,但让我告诉您,几个月前我遇到了相同的问题,直到现在我还没有解决它。
让我看看我的配置,也许也能帮你
祝你好运
/*--- Mail Init Config ---*/
$config = array();
$config['useragent'] = 'My company';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = 'someemail@outlook.com';
$config['smtp_pass'] = 'myPassword';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = 30;
$config['smtp_crypto'] = 'tls';
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['crlf'] = "\r\n"; //in my case new line added
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;
$config['dsn'] = FALSE;
嗨,Digpal,谢谢你的回复。但是,在应用您的代码之后,我出现了这个错误:
调用未定义的方法CI_Email::IsHTML()
谢谢您的回复,但是在我尝试了您的代码之后,没有什么不同。在我的情况下,是的,仍然是这样
/*--- Mail Init Config ---*/
$config = array();
$config['useragent'] = 'My company';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.office365.com';
$config['smtp_user'] = 'someemail@outlook.com';
$config['smtp_pass'] = 'myPassword';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = 30;
$config['smtp_crypto'] = 'tls';
$config['wrapchars'] = 76;
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['crlf'] = "\r\n"; //in my case new line added
$config['newline'] = "\r\n";
$config['bcc_batch_mode'] = FALSE;
$config['bcc_batch_size'] = 200;
$config['dsn'] = FALSE;