Welcome Guest, Not a member yet? Register   Sign In
email class
#1

[eluser]theknight[/eluser]
Hi,

I have written the following code

Code:
$config=Array(
        'protocol'=> 'smtp',
        'mailtype'=> 'html',
        'smtp_host'=> 'ssl://smtp.googlemail.com',
        'smtp_port'=> 465,
        'smtp_user'=> '*********@gmail.com',
        'smtp_pass'=> '*********'
        
    );
    
    $this->load->library('email',$config);
        $this->email->set_newline("\r\n");
    //$this->email->initialize($config);

        $this->email->from(($from!==null?$from:$this->admin_email),
                           'Facebook');
        $this->email->to($to);

        $this->email->subject($template['subject']);
        $this->email->message($template['message']);
        $this->email->send();
        echo $this->email->print_debugger();
    }
    
    // getting template
    function getTemplate($tpl_id){
        return getRow($this->table,'*','id='.$tpl_id);
    }
}

Now it works perfectly until I add 'mailtype'=> 'html', into the array. I want the emails that are sent to be html and not text based, how can I get it to do this?

Thanks
#2

[eluser]freeman[/eluser]
Hmm, how about on the initialize and/or set_mailtype as well

Code:
$this->load->library('email');

$config = array(
    'protocol'=> 'smtp',
    'mailtype'=> 'html',
    'smtp_host'=> 'ssl://smtp.googlemail.com',
    'smtp_port'=> 465,
    'smtp_user'=> '*********@gmail.com',
    'smtp_pass'=> '*********',
    'mailtype' => 'html'
);

$this->email->initialize($config);

// set from, to, subject, message

// un-comment this line and see if it affects the output
// $this->email->set_mailtype('html');

$this->email->send();

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




Theme © iAndrew 2016 - Forum software by © MyBB