3

I am trying to send an email from my PHP script. The email is send automatically through cron jobs. But when i got the email the bootstrap design has broken off. I am linking the following jquery and bootstrap files;

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>

I guess gmail will block the external css. Which is the best way for this to work?

Sanju
  • 55
  • 2
  • 5

2 Answers2

5

You should not use external styling-files for HTML-mails. To get your mail work with all mail-clients you should use HTML4 and CSS in style-tags or inline-CSS. Also use tables instead of divs to make multi-column-emails.

There are a lot of tutorials for HTML-mails in the internet. Just search for "style html mails".

Best practices for styling HTML emails

codeneuss
  • 905
  • 4
  • 12
1

Oooh i know you think that to include the bootstrap link or the jquery link may be interpreded by the mail server but that is totaly false. there is a standard and some tools to let you build smarter emails if you are realy interested you can follow this likn and copy paste the code from there to your editor then edid it for content copyright

https://codepen.io/zavoloklom/pen/qEVqzx

<html>
  <!-- do not consider this, you have only t follow the link above-->
</html>
Ir Calif
  • 460
  • 6
  • 7