How to display the <iframe> tag in gmail

I use codeigniter to send an email ... After activating a user account, it sends another letter to insert the tag, but when the user receives the message, the tag does not appear, but when I tried to use other elements, for example, or it displays the style, but how come not?

$message = 'Congratulations! Use the script below to add your widget.<br>'; $message .= "<iframe frameborder=\"0\" src=\"<?=base_url() ?>business/widget/{$id}\" height=\"320px;\" width=\"480px\" style=\"border: 1px solid #ccc;\"></iframe>"; $this->email->message($message); if($this->email->send()) { other code.... } 
+6
source share
2 answers

Gmail and many other email clients are very strict about what HTML you can use in your HTML emails.

<iframe> strictly forbidden because it can expose a user to a website that they did not expect, and the website at the other end can record information about the user (for example, their IP address). Images are blocked for the same reasons.

If I were you, I would stick to using super basic HTML and CSS. Focus on getting the message to the user and hope that his client will make the message beautiful. Always offer a link to view the full message elsewhere.

+13
source

<iframe> cannot be used in most email clients - whether in the application or as a website. They are either shared for one of several reasons:

  • The mail client / web client may have problems displaying it, so it is excluded.
  • <iframe> can be used for phishing / malicious attacks, placing malicious code in something that was also tested and safe at the same time (the browser / client cannot see or scan what is loaded in the iframe, it just loads it into the DOM).

An alternative (what YouTube does), instead of embedding something in an iframe (in their case, a video), they have a <a> wrapped around an <img> or a thumbnail, giving the impression that you are playing a video. Everything that you do when you click on it gets to this URL.

If you tried to put the extended code in an email, you can manually write it. This, however, has other effects, as some other tags are limited / stylists can be a big problem for emails. AFAIK some HTML5 elements are also removed from emails.

Like Orangepill , Campaign Monitor did the job and provided a diagram showing where iframes can be used . They also suggest staying away from iframes.

A solution not mentioned should be to have an image with a link below that says "View this message" on a web page that will lead the user to a page with an <iframe> .

+5
source

Source: https://habr.com/ru/post/946743/


All Articles