简体   繁体   English

CodeIgniter发送奇怪的电子邮件

[英]CodeIgniter weird emails being sent

I have a function that I can pass parameters to easily send emails. 我有一个功能,我可以传递参数来轻松发送电子邮件。

This is it : 就是这个 :

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;
        }
    }

The emails I am receiving are (which I should not be receiving) : 我收到的电子邮件(我不应该收到):

?= =?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; ?= =?utf-8?Q?2013?=回复:“SUNYOrangeScholarInterface@gmail.com”X-Sender:SUNYOrangeScholarInterface@gmail.com X-Mailer:CodeIgniter X-Priority:3(正常)消息ID: <520eb8d943533@gmail.com> Mime-Version:1.0 Content-Type:multipart / alternative; boundary="B_ALT_520eb8d943598" 边界= “B_ALT_520eb8d943598”

This is a multi-part message in MIME format. 这是MIME格式的多部分消息。 Your email application may not support this format. 您的电子邮件应用程序可能不支持此格式

--B_ALT_520eb8d943598 Content-Type: text/plain; --B_ALT_520eb8d943598内容类型:text / plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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. 您好Rixhers Ajazi这是一封自动发送的电子邮件,通知您您的帐户已成功创建。您必须等待您的帐户被验证,这意味着您无权使用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)只是想提醒您,如果您不保证您的安全答案安全,那么有人可以接管您的帐户。任何问题是什么所以,使用ScholarInterface,请发送电子邮件至Rixhers Ajazi,电子邮件地址为CoderRix@gmail.com。有关您帐户的问题,请通知您的管理员。 Rixhers Ajazi is not a Administrator but a Super User (the coder of this program). Rixhers Ajazi不是管理员,而是超级用户(该程序的编码员)。

--B_ALT_520eb8d943598 Content-Type: text/html; --B_ALT_520eb8d943598内容类型:text / html; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 . 您好Rixhers Ajazi这是一封自动发送的电子邮件,通知您已成功创建您的acco = unt。您必须等待您的帐户被验证,这意味着您无权使用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. On = ce您的帐户已被激活,并且您将获得一个用户角色,您将通过电子邮件发送消息。请注意,由于您已创建帐户,因此您需要负责保护您的凭据安全。 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. 这些包括你的em = ail帐户,你的安全问题的答案,以及你的密码,它= elf.I(Rixhers Ajazi)只是想警告你,如果你不保持你的安全答案安全,那么有人可以接管您的帐户。任何问题= ScholarInterface的内容,请发送电子邮件至Rixhers Ajazi,电子邮件地址为Cod = erRix@gmail.com。有关您帐户的问题,请通知您的=管理员。 Rixhers Ajazi is not a Administrator but a Super User (the = coder of this program). Rixhers Ajazi不是管理员,而是超级用户(该程序的编码员)。

--B_ALT_520eb8d943598-- --B_ALT_520eb8d943598--

The hell is this? 这到底是什么?

This is my configuration in email.php : 这是我在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';

I use the same script with another application and I haven't ever gotten this. 我使用相同的脚本与另一个应用程序,我从来没有得到这个。 Any help would be great. 任何帮助都会很棒。

The message at the top of the email seems to start from the subject header, so I would guess that would be a good place to start debugging. 电子邮件顶部的消息似乎从主题标题开始,所以我猜这将是一个开始调试的好地方。

There used to be an issue caused by Subject lines with more than 75 chars . 曾经存在由超过75个字符的主题行引起问题

If the above fix doesn't work, then the devs have patched the Email.php to solve the problem: 如果上面的修复不起作用,那么开发人员已修补Email.php来解决问题:

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

Just add this in start of the function where you are writing send email code 
$config = Array(
          'protocol' => 'sendmail',
          'mailtype' => 'html', 
          'charset' => 'utf-8',
          'wordwrap' => TRUE

      );
     $this->email->initialize($config);
Email will forward but error same error will show

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM