Send iframe using youtube to email body

I want to send some html to the body of the email, but gmail does not interpret the iframe tag from the youtube video. Is it due to security breaches 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(); 
+7
source share
2 answers

This is due to security, for the same reason that you cannot put javascript or anything external than images in an email - it can lead to an overly strong email. (You can put things there, they will not be displayed). Unfortunately, this means a lack of reliable flash support.

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

Your best / only option is just a link to the video that I'm afraid of. As mentioned above, Gmail will analyze Youtube links and actually implement them for those who have it enabled.

+7
source

Many mail servers do not allow this for security reasons. But you can try the following solutions.

Solution 1:

  $var = html_escape('<iframe title="YouTube video player" width="480" height="390" src="<url>" frameborder="0" allowfullscreen></iframe>'); $this->email->message($var); 

Solution 2:

 $this->email->message('<&nbs;iframe title="YouTube video player" width="480" height="390" src="<url>" frameborder="0" allowfullscreen><&nbs;/iframe>'); 

However, in decision 2, you need to tell the recipient to remove the place from the tag.

0
source

All Articles