0

I'm trying to send an email with html formatting, but when it arrives (in gmail and on my phone), it has had all the tags removed and just a few lines of the text (no < or >). I have the header MIME-Version and content-type set correctly, and when I take the original message and place that into an html file, it shows with all the text. There are no class attributes set, but rather all stored in the style attribute. Does anyone know what is removing the tags and styling? Is it Gmail, or something I'm missing?

Delivered-To: [email protected]
Received: by 10.220.91.15 with SMTP id xxxxxxxxx;
        Mon, 20 Feb 2012 10:41:39 -0800 (PST)
Received: by 10.180.90.225 with SMTP id xxxxxxxxx;
        Mon, 20 Feb 2012 10:41:39 -0800 (PST)
Return-Path: <[email protected]>
Received: from xxxxxxxxx.net (xxxxxxxxx.net. [xxx.xxx.xxx.xxx])
        by mx.google.com with ESMTPS id xxxxxxxxx
        (version=TLSv1/SSLv3 cipher=OTHER);
        Mon, 20 Feb 2012 10:41:39 -0800 (PST)
Received-SPF: pass client-ip=xxx.xxx.xxx.xxx;
Authentication-Results: mx.google.com; spf=pass smtp.mail=xxxxxxxxx.net
Received: from xxxxxxxxx by xxxxxxxxx.net with local (Exim 4.69)
    (envelope-from <[email protected]>)
    id xxxxxxxxx
    for [email protected]; Mon, 20 Feb 2012 18:41:34 +0000
To: [email protected]
Subject: Email Subject
X-PHP-Script: xxxxxxxxx.co.uk/cronjob.php for xxx.xxx.xxx.xxx
From: xxxxxxxx <[email protected]>
MIME-Version: 1.0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Message-Id: <[email protected]>
Date: Mon, 20 Feb 2012 18:41:34 +0000
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - xxxxxxxxx.net
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [1119 32003] / [47 12]
X-AntiAbuse: Sender Address Domain - xxxxxxxxx.net
X-Source: /usr/local/lsws/fcgi-bin/lsphp-5.2.17
X-Source-Args: lsphp5:dig/public_html/xxxxxxxxx/cronjob.php
X-Source-Dir: xxxxxxxxx.co.uk:/public_html

<html><body style="color: #333;font-family: 'Myriad Pro';font-size: 18px;margin: 0;padding: 0;text-align: center;"><div style="background-color: #9C3;background-repeat: no-repeat;border: solid 1px #9C3;height: 32px;margin: 0 auto;width: 400px;"></div><div style="background-color: #FFF;border-bottom: solid 1px #9C3;border-left: solid 1px #9C3;border-right: solid 1px #9C3;margin: 0 auto;padding-bottom: 50px;width: 400px;"><div style="border-bottom: solid 1px #E1E1E1;padding-bottom: 10px;padding-top: 20px;">Hi xxxx,<br /><br />Here is a daily digest of recent interaction<br />regarding your activities.<br /><strong>Your attention is required</strong><br /></div><div style="background-color: #F3F3F3;border-bottom: solid 1px #E1E1E1;padding: 10px 0;"><div style="font-size: 20px;">Item 1</div><div style="color: #0066FF;font-size: 16px;">Booking Requested</div><div style="font-size: 14px;">Made by xxxx for 17:30 on Tue, Mar 13th 2012</div></div><div style="background-color: #F3F3F3;border-bottom: solid 1px #E1E1E1;padding: 10px 0;"><div style="font-size: 20px;">Item 2</div><div style="color: #0066FF;font-size: 16px;">Booking Requested</div><div style="font-size: 14px;">Made by xxxx for 18:15 on Tue, Mar 6th 2012</div></div><br /><br /><a href="#" style="background-color: #99CC33;border: solid 1px #64A100;border-radius: 7px;color: #fff;margin: 3px 2px 3px 2px;padding: 7px 10px;text-align: center;text-decoration: none;cursor: pointer;cursor: hand;">Login</a></div></body></html>
3
  • It sounds like you're not doing any multipart separation - edit your question to add your code Commented Feb 20, 2012 at 18:50
  • Do you tried to send plain text mail... Is it the same situation? Commented Feb 20, 2012 at 18:55
  • @adam i tried that, but when it arrived, it was being treated like plain text. Commented Feb 20, 2012 at 18:59

3 Answers 3

1

Styling emails is very limited, there are very few rules that are accepted and usually you set them inline style.

Html email templates:

CSS support in email: http://www.campaignmonitor.com/css/

Sorry if I misunderstood the question, if so, let me know.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't know that this is the cause, because different mail clients and webmails will interpret it differently, but your email is definitely invalid, according to RFC 2822; so you're likely to run into problems at some point.

  • Lines of characters in the body MUST be limited to 998 characters, and SHOULD be limited to 78 characters, excluding the CRLF.

I count your HTML line as being 1494 characters long, so you MUST wrap it onto at least two lines.

You would normally see lines of 80 characters (including CRLF), but that's mainly for display purposes (and dates back to a time when computer monitors ran significantly lower resolutions). The limit of 1000 characters (including CRLF) is much more important.

Also make sure you are using CRLF to separate each line.

Comments

0

sorry, i was a fool, i forgot that between the style= and the ", you need to have 3D written in. Works beautifully now.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.