簡體   English   中英

CodeIgniter發送奇怪的電子郵件

[英]CodeIgniter weird emails being sent

我有一個功能,我可以傳遞參數來輕松發送電子郵件。

就是這個 :

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?=回復:“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; 邊界= “B_ALT_520eb8d943598”

這是MIME格式的多部分消息。 您的電子郵件應用程序可能不支持此格式

--B_ALT_520eb8d943598內容類型:text / plain; charset = utf-8 Content-Transfer-Encoding:8bit

您好Rixhers Ajazi這是一封自動發送的電子郵件,通知您您的帳戶已成功創建。您必須等待您的帳戶被驗證,這意味着您無權使用ScholarInterface。 一旦您的帳戶被激活並且您被授予用戶角色,您將收到電子郵件通知。請注意,由於您已創建帳戶,因此您有責任保護您的憑據安全。 這些包括您的電子郵件帳戶,您對安全問題的答案以及您自己的密碼。我(Rixhers Ajazi)只是想提醒您,如果您不保證您的安全答案安全,那么有人可以接管您的帳戶。任何問題是什么所以,使用ScholarInterface,請發送電子郵件至Rixhers Ajazi,電子郵件地址為CoderRix@gmail.com。有關您帳戶的問題,請通知您的管理員。 Rixhers Ajazi不是管理員,而是超級用戶(該程序的編碼員)。

--B_ALT_520eb8d943598內容類型:text / html; charset = utf-8 Content-Transfer-Encoding:quoted-printable

您好Rixhers Ajazi這是一封自動發送的電子郵件,通知您已成功創建您的acco = unt。您必須等待您的帳戶被驗證,這意味着您無權使用ScholarInterface On = ce您的帳戶已被激活,並且您將獲得一個用戶角色,您將通過電子郵件發送消息。請注意,由於您已創建帳戶,因此您需要負責保護您的憑據安全。 這些包括你的em = ail帳戶,你的安全問題的答案,以及你的密碼,它= elf.I(Rixhers Ajazi)只是想警告你,如果你不保持你的安全答案安全,那么有人可以接管您的帳戶。任何問題= ScholarInterface的內容,請發送電子郵件至Rixhers Ajazi,電子郵件地址為Cod = erRix@gmail.com。有關您帳戶的問題,請通知您的=管理員。 Rixhers Ajazi不是管理員,而是超級用戶(該程序的編碼員)。

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

我使用相同的腳本與另一個應用程序,我從來沒有得到這個。 任何幫助都會很棒。

電子郵件頂部的消息似乎從主題標題開始,所以我猜這將是一個開始調試的好地方。

曾經存在由超過75個字符的主題行引起問題

如果上面的修復不起作用,那么開發人員已修補Email.php來解決問題:

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