php - 发送 CodeIgniter 奇怪的电子邮件

标签 php codeigniter email html-email

我有一个函数,我可以传递参数来轻松发送电子邮件。

就是这样:

function __construct() {
        $this -> CI = get_instance();
        $this -> CI -> load -> library('email');
    }

    public function send_one_email($single_email, $single_subject, $single_body, $single_attach) {
        $this -> CI -> email -> clear();
        $this -> CI -> email -> to($single_email);
        $this -> CI -> email -> from('**************');
        $this -> CI -> email -> subject($single_subject);
        $this -> CI -> email -> message($single_body);

        if ($single_attach) {
            $this -> CI -> email -> attachment($single_attach);
        }

        if ($this -> CI -> email -> send()) {
            return TRUE;
        }
    }

我收到的电子邮件是(我不应该收到的):

?= =?utf-8?Q?2013?= Reply-To: "SUNYOrangeScholarInterface@gmail.com" X-Sender: SUNYOrangeScholarInterface@gmail.com X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <520eb8d943533@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_520eb8d943598"

This is a multi-part message in MIME format. Your email application may not support this format.

--B_ALT_520eb8d943598 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit

Hello Rixhers Ajazi this is an automated email to notify you that your account has been successfully created.You must wait for your account to be verified meaning that you do not have access to use ScholarInterface. Once your account is activated and you are given a user role you will be notified via email.Please be advised that since you have created your account you are responsible for keeping your credentials safe. These include your email account, your answers to your security questions, and your password itself.I (Rixhers Ajazi) just want to warn you that if you do not keep your security answers safe then some one can take over your account.Any questions what so ever with ScholarInterface please email Rixhers Ajazi at CoderRix@gmail.comAny questions pertaining to your account please notify your Administrators. Rixhers Ajazi is not a Administrator but a Super User (the coder of this program).

--B_ALT_520eb8d943598 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

Hello Rixhers Ajazi this is an automated email to notify you that your acco= unt has been successfully created.You must wait for your account to be veri= fied meaning that you do not have access to use ScholarInterface. On= ce your account is activated and you are given a user role you will be noti= fied via email.Please be advised that since you have created your account y= ou are responsible for keeping your credentials safe. These include your em= ail account, your answers to your security questions, and your password its= elf.I (Rixhers Ajazi) just want to warn you that if you do not keep your se= curity answers safe then some one can take over your account.Any questions = what so ever with ScholarInterface please email Rixhers Ajazi at Cod= erRix@gmail.comAny questions pertaining to your account please notify your = Administrators. Rixhers Ajazi is not a Administrator but a Super User (the = coder of this program).

--B_ALT_520eb8d943598--

这是什么鬼?

这是我在 email.php 中的配置:

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 $config['protocol'] = 'smtp';
 $config['smtp_host'] = 'ssl://smtp.googlemail.com';
 $config['smtp_user'] = '********************@gmail.com';
 $config['smtp_pass'] = '**************************';
 $config['smtp_port'] = 465;
 $config['smtp_timeout'] = 30;
 $config['charset'] = 'utf-8';
 $config['crlf'] = "\r\n";
 $config['newline'] = "\r\n";
 $config['wordwrap'] = TRUE;
 $config['mailtype'] = 'html';

我在另一个应用程序中使用了相同的脚本,但我从来没有得到过这个。任何帮助都会很棒。

最佳答案

电子邮件顶部的消息似乎是从主题标题开始的,所以我猜这是开始调试的好地方。

曾经有一个issue caused by Subject lines with more than 75 chars .

如果上述修复不起作用,则开发人员已修补 Email.php 以解决问题:

https://github.com/EllisLab/CodeIgniter/issues/1409#issuecomment-9330713

关于php - 发送 CodeIgniter 奇怪的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18283661/

相关文章:

php - 嵌套的匿名函数

php - Zend Server Job 前身失败依赖

php - 跟踪(直接)文件下载的最佳方式

php - codeigniter CRUD 操作,具有搜索和用户定义的 per_page

java - 估计新邮件的大小

将十六进制转换为纬度和经度所需的 PHP 函数

php - 如何为此查询在 codeigniter 事件记录中编写子查询

mysql - 需要在不同的域中但使用不同的数据库部署相同的 Codeigniter 代码

c# - 服务器响应为 : 5. 7.3 请求的操作已中止;用户未通过身份验证

excel - 根据单元格值发送电子邮件