Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

send iframe with youtube in email body

i want to send some html in email body, but gmail doesn't interpret iframe tag with youtube video. Is it because of security violations or other reasons?

here is my code:

    this->load->library('email');       
    $config['mailtype'] = 'html';
    $config['wordwrap'] = TRUE;
    $this->email->initialize($config);
        $this->email->from('<email>', 'Alega');
        $this->email->to('<email>'); 
        $this->email->subject('Email Test');
        $this->email->message('<iframe title="YouTube video player" width="480" height="390" src="<url>" frameborder="0" allowfullscreen></iframe>');   

            $this->email->send();
like image 637
alega Avatar asked Mar 17 '11 12:03

alega


1 Answers

It's because of security, it's the same reason you can't put javascript or anything external other than images in an email either - it can give the email too much 'power'. (You can put stuff there, it wont be displayed). Sadly this means no reliable flash support either.

In fact, most email readers will not parse even simple tags or CSS because of lack of support, I actually revert to tables just to make sure that the email looks consistent across all the different email clients out there.

Your best/only option is to just link to the video I'm afraid. As mentioned above, Gmail will parse the Youtube links and actually embed them for people who have it enabled.

like image 159
Dunhamzzz Avatar answered Oct 13 '22 12:10

Dunhamzzz