简体   繁体   中英

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; 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 . 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 please email Rixhers Ajazi at Cod= erRix@gmail.comAny questions pertaining to your account please notify your = Administrators. 请发送电子邮件至Rixhers Ajazi,电子邮件地址为Cod = erRix@gmail.com。有关您帐户的问题,请通知您的=管理员。 Rixhers Ajazi is not a Administrator but a Super User (the = coder of this program).

--B_ALT_520eb8d943598--

The hell is this?

This is my configuration in 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 .

If the above fix doesn't work, then the devs have patched the Email.php to solve the problem:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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