簡體   English   中英

CodeIgniter / TankAuth forgot_password函數發送無內容的電子郵件

[英]CodeIgniter/TankAuth forgot_password function sending emails with no content

最近將現有的CodeIgniter產品移至其自己的VPS,一切都在進行中。 但是,由於某種原因,密碼已失效,並且在運行了忘了密碼功能時,電子郵件的主題行完整無缺,但是電子郵件中沒有內容。 完全沒有 這是令人反感的代碼:

function _send_email($type, $email, &$data) {
        $this->load->library('email');
        $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
        $this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
        $this->email->to($email);
        $this->email->subject(sprintf($this->lang->line('auth_subject_' . $type), $this->config->item('website_name', 'tank_auth')));
        $this->email->message($this->load->view('email/' . $type . '-html', $data, TRUE));

    echo $this->load->view('email/' . $type . '-html', $data, TRUE);

        $this->email->set_alt_message($this->load->view('email/' . $type . '-txt', $data, TRUE));
        $this->email->send();
    }

我編寫了一個簡短的PHP腳本,以使用相同的CodeIgniter庫發送電子郵件:

<?php

if(!defined('BASEPATH'))exit('不允許直接腳本訪問');

class EmailTest extends CI_Controller{

    function __construct(){
        parent::__construct();
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        $this->load->library('tank_auth');
        $this->lang->load('tank_auth');
    }

    function sendTest(){
        $this->load->library('email');
        $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
        //$this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));


        $this->email->to('cameron.j.leafe@gmail.com');
        $this->email->subject("Here and There");
        $this->email->message("I hear you are an example");
        $this->email->send();

        echo $this->email->print_debugger();
    }
}
?>

該電子郵件完全正常,並產生以下輸出:

User-Agent: CodeIgniter
Date: Mon, 14 Apr 2014 18:55:55 +1000
From: "EPI Dashboard" <epi@epidashboard.com>
Return-Path: <epi@epidashboard.com>
Reply-To: "epi@epidashboard.com" <epi@epidashboard.com>
X-Sender: epi@epidashboard.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <534ba29b87010@epidashboard.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_534ba29b8708b"


=?utf-8?Q?Here_and_There?=
This is a multi-part message in MIME format.
Your email application may not support this format.

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

I hear you are an example


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

I hear you are an example

--B_ALT_534ba29b8708b--

該服務器是運行postfix的CentOS 6 VPS,顯然是PHP / MySql / Apache。

對於檢查內容的任何想法或您可以想到的任何資源,將不勝感激。

此服務器的PHP.INI文件需要包含以下行:

sendmail_path = /usr/sbin/sendmail -t -i

可以立即解決問題。 不能完全確定為什么顯示電子郵件的一部分而不顯示正文,但是它可以工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM