codeigniterion-auth

Email subject line starts with “?utf-8?Q?” in codeigniter project


Email subject line starts with ?utf-8?Q? in codeigniter 3.1

When I send email by email library email deliver properly but subject not showing properly it's look like ?utf-8?Q?====? sdfdfd ?utf-8?Q?

Also I am using ion_auth for sending email.

If any suggestion please add


Solution

  • Replace this code in you file

    \system\libraries Email.php file

    public function subject($subject)
    {
      $subject = $this->_prep_q_encoding($subject);
      $this->set_header('Subject', $subject);
      return $this;
    }
    

    To

    public function subject($subject)
    {
       $subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
       $this->_set_header('Subject', $subject);
       return $this;
    }
    

    and set the email configuration in your email config

    $config = array(
        'protocol' => 'smtp',
        'charset' => 'utf-8',
        'newline' => "\r\n",
        'crlf' => "\n",
        'mailtype' => "html"
    );