Zen
Zen

Reputation: 7385

Cannot send HTML Emails

Well I'm trying to send a HTML email using gmail smtp from CI, and it seems to reject my emails when they have any amount of tables. No error is given, they just do not appear in my inbox.

If I send an email with light HTML and no tables, they go through. Anyone have any insight?

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '[email protected]',
        'smtp_pass' => '--------',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
 );

    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('myEmail', 'myName');
    $this->email->to($this->input->post('email')); 

    $this->email->subject('mySubject');
    $msg = $this->load->view('partials/email', '', true);
    $this->email->message($msg); 

    $this->email->send();`

Upvotes: 0

Views: 1341

Answers (2)

Vlad Balmos
Vlad Balmos

Reputation: 3412

Include also the text/plain version of the message. Maybe it will go through, if you say that light html works

Upvotes: 0

bensiu
bensiu

Reputation: 25554

Using PHP double quotes evaluate variables and control characters (e.g. \n or \r), whereas single quotes do not. Also open the way to different interpretation = (equal sign). It not using TABLE is generation problem it is any tag with parameter ="value".

Make sure you have right string in single quotes, test this on basic A tag

The content of view 'partial/email' is the key

Upvotes: 1

Related Questions