我使用codeigniter发送一些电子邮件。除了主题外,一切都很好。我正在创建这样的自定义主题行
$mailSubject = "Customer Query | " . $bookingID . " | " . $requestID;
像这样使用它
$this->email->subject($mailSubject);
但是当我收到电子邮件时,主题行看起来像
Customer_Query_|_6223871_|_92
相反,我需要它就像
Customer Query | 6223871 | 92
这是我的职责
> public function sendEmail($data) {
> $config = Array(
> 'protocol' => 'smtp',
> 'smtp_host' => 'ssl://sub5.mail.xxxxx.com',
> 'smtp_port' => 465,
> 'smtp_user' => 'account@xxxxx.com',
> 'smtp_pass' => 'xxxxx',
> 'mailtype' => 'html',
> 'charset' => 'iso-8859-1',
> 'wordwrap' => TRUE
> ); //set the basic configurations
>
> $bookingID = $data['booking_id'];
> $requestID = $data['requestID'];
>
> $productCategory = "";
> if($data['regarding'] == 1){
> $productCategory = "Flights";
> }else if($data['regarding'] == 2){
> $productCategory = "Hotels";
> }else if($data['regarding'] == 3){
> $productCategory = "Visa Services";
> }else if($data['regarding'] == 4){
> $productCategory = "Travel Insurance";
> }
>
> $queryType = "";
> if($data['request_type'] == 1){
> $queryType = "General";
> }else if($data['request_type'] == 2){
> $queryType = "Feedback";
> }else if($data['request_type'] == 3){
> $queryType = "Complain";
> }else if($data['request_type'] == 4){
> $queryType = "Flight Inquiry";
> }else if($data['request_type'] == 5){
> $queryType = "Hotel Inquiry";
> }else if($data['request_type'] == 6){
> $queryType = "Refund";
> }else if($data['request_type'] == 7){
> $queryType = "Cancellation";
> }else if($data['request_type'] == 8){
> $queryType = "Re-Scheduling";
> }else if($data['request_type'] == 9){
> $queryType = "E-ticket";
> }else if($data['request_type'] == 10){
> $queryType = "Invoice";
> }else if($data['request_type'] == 11){
> $queryType = "Visa Request";
> }else if($data['request_type'] == 12){
> $queryType = "Travel Insurance Request";
> }else if($data['request_type'] == 13){
> $queryType = "Date Change";
> }
>
> $comments = $data['comments'];
> $fname = $data['fname'];
> $lname = $data['lname'];
> $cusEmail = $data['email'];
> $mobileNo = $data['contact_no'];
> $subject = $data['subject'];
>
> $toEmail = "";
> if($productCategory == 2){
> $toEmail = "hotels@xxxxx.com";
> }else{
> $toEmail = "flights@xxxxx.com";
> }
>
> $mailSubject = "Customer Query | " . $bookingID . " | " . $requestID;
>
> //prepare the message
> $message = '<center><p><u>Customer Query</u></p></center>
> <p>Customer Query - '.$productCategory.' - '.$queryType.' </p>
> <br/>
> <p><b><u>Booking Details</u></b></p>
> <br/>
> <p>Product Category : '.$productCategory.'</p>
> <p>Query Type : '.$queryType.' </p>
> <p>Booking ID : '.$bookingID.'</p>
> <p>Subject : '.$subject.'</p>
> <p>Comments : </p>
> <p><b>'.$comments.'</b></p>
> <br/>
> <p><b><u>Passenger Details</u></b></p>
> <br/>
> <p>First Name : '.$fname.'</p>
> <p>Last Name : '.$lname.'</p>
> <p>Email : '.$cusEmail.'</p>
> <p>Mobile No : '.$mobileNo.'</p>'; //end the message
>
> //mail sending details
> $this->load->library('email', $config);
> $this->email->set_crlf("\r\n");
> $this->email->from($cusEmail, $fname.' '.$lname);
> $this->email->to('eranga.p@xxx.lk');
> $this->email->subject($mailSubject);
> $this->email->message($message);
>
> if ($this->email->send()) {//send mail and check weather it is sent successfully
> return TRUE;
> } else {
> return FALSE; //returns false if email not sent
> }
> }
我找到了问题的原因。这只发生在我的邮件服务器上。对于其他邮件服务器来说,这并没有发生。即使在前景方面也不错。我真的很抱歉浪费了你宝贵的时间。
设定你的
$config['mailtype'] ='html';
然后
$mailSubject = "Customer Query | ".$bookingID." | ".$requestID;//$nbsp; is space it is replace because your mailtype is html
$this->email->subject($mailSubject);
替换$this-
具有
$this->load->library('email');
$this->email->initialize($config);
请尝试使用下面的配置参数
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://sub5.mail.xxxxx.com',
'smtp_port' => 465,
'smtp_user' => 'account@xxxxx.com',
'smtp_pass' => 'xxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'remove_space' => FALSE
); //set the basic configurations
我已经从CodeIgniter发送了一封电子邮件,但我不知道为什么我的电子邮件会被截断,或者它会被包含在带有问号的黑钻石中。这是真的,我使用波斯字符,但标题是utf-8无论如何。下面是发送电子邮件的CodeIgniter代码: 只要注意主题中的非拉丁字符:
问题内容: 我正在尝试在带有附件的codeigniter上发送电子邮件。 我总是成功收到电子邮件。但是,我从未收到带有附件的文件。以下是代码,非常感谢所有评论。 问题答案: $ this- >电子邮件-> attach() 使您可以发送附件。将文件路径/名称放在第一个参数中。注意:使用文件路径,而不是URL。对于多个附件,请多次使用该功能。例如:
问题内容: 问题答案: $config = Array( ‘protocol’ => ‘smtp’, ‘smtp_host’ => 'ssl://smtp.googlemail.com’, ‘smtp_port’ => 465, ‘smtp_user’ => ‘xxx’, ‘smtp_pass’ => ‘xxx’, ‘mailtype’ => ‘html’, ‘charset’ => ‘iso-8
申请工作需要发送一封电子邮件,其中包含一些详细信息,如姓名、电话号码、电子邮件、当前ctc etcc...电子邮件发送正确,但问题是在主题行发送电子邮件时,我需要包括姓名电子邮件ctc...为此,我已经这样做了,但它不接受这种格式。
如何发送带有文件的php电子邮件 Antrag=图像文件 我所尝试的 输出电子邮件: 控制器 看法
在本章中,我们将了解如何使用JavaMail API删除电子邮件。 删除消息涉及使用与消息关联的标志。 不同的状态有不同的标志,一些是系统定义的,一些是用户定义的。 预定义标志在内部类Flags.Flag中定义,如下所示: Flags.Flag.ANSWERED Flags.Flag.DELETED Flags.Flag.DRAFT Flags.Flag.FLAGGED Flags.Flag.RE