Reputation: 269
How can i send a iframe in email body.This is how i am simply sending a mail.
string getemail = textbox_email.Text;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(getemail);
message.Subject = "Hello";
message.From = new System.Net.Mail.MailAddress("sendingemail");
message.Body = "This is message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.Credentials = new System.Net.NetworkCredential("sendingemail", "password");
smtp.EnableSsl = true;
smtp.Send(message);
Response.Write("Sent");
This is iframe in html.Actully iframe will contain the youtube video link.
<iframe id="iframe" runat="server" src="http://www.w3schools.com" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
How can i send it in email body? Thanks in advance.
Upvotes: 1
Views: 9301
Reputation: 100545
You can use either IsBodyHtml property or AlternativeViews to send HTML.
If you expect that client will render content inside your IFrame it very likely not to happen due to security restrictions in mail clients (similar to blocking external images).
Upvotes: 1
Reputation: 871
While it IS extremely unlikely that your email recipient's client will render the iframe, depending on your intended goal, you may want to look into the DownloadString method of the WebClient class.
Upvotes: 0