How to add embedded video inside E-mail?

Can I add video to e-mail content?

This is my postal code.

$to = 'my_mail@gmail.com';
$sub = 'my Subject';

$msg = '<html><body>';
$msg .= '<table rules="all" style="border: 1px solid #000000" cellpadding="10">';
$msg .= '<caption style="font-size: 18pt"><strong>Feedback from Customers</strong></caption>';
$msg .= "<tr><td width='25'><strong>Name</strong> </td><td width='60'>".strip_tags($_POST['name'])."</td></tr>";
$msg .= "<tr><td><strong>Email</strong> </td><td>" .strip_tags($_POST['mail']) . "</td></tr>";
$msg .= "<tr><td><strong>Country</strong> </td><td>" .strip_tags($_POST['country']) . "</td></tr>";
$msg .= "<tr><td><strong>Message</strong> </td><td>" . strip_tags($_POST['message']). "</td></tr>";
$msg .= "</table>";

//in here i want add viedo

$msg .= "</body></html>";

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

mail($to, $sub, $msg, $headers);

I want to add <iframe width="100%" height="500" src="https://www.youtube.com/embed/zsqtjnHQWQ8" frameborder="0" allowfullscreen=""></iframe>inside emails that are sent to the client.

How can I implement this?

+4
source share
2 answers

Using a message iframein an email message is not supported. For more information, see Link. It’s also the wrong way to embed videos on YouTube. If you go to YouTube and share the video by email with yourself, you can check the html content of this email to find out how to embed the video correctly.

A static clickable image that redirects the user to YouTube.

<a href="http://www.youtube.com/watch?v=Bk_6r-b3kqU&feature=em-share_video_user">
 style="text-decoration:none;display:block" 
 class="nonplayable" 
 target="_blank">
  <img src="http://i3.ytimg.com/vi/Bk_6r-b3kqU/mqdefault.jpg" height="274" width="498">
 < /img></a>

( -)

<embed width="640" height="385" base="https://www.youtube.com/v/" wmode="opaque" id="swfContainer0" type="application/x-shockwave-flash" src="https://www.youtube.com/v/Bk_6r-b3kqU?border=0&autoplay=1&client=ytapi-google-gmail&version=3&start=0">

- , JavaScript - , , - " " . ( , ). , .

Gmail YouTube , .

+10

User Experience , . :

  • , . , Plaintext. HTML .
  • , , .
  • , , . .
+3

All Articles