2012-02-20 5 views
0

私はhtmlフォーマットで電子メールを送信しようとしていますが、到着すると(Gmailおよび携帯電話で)、すべてのタグが削除され、数行のテキストが残っています(<または>)。 MIME-Versioncontent-typeというヘッダが正しく設定されています。元のメッセージを取り出してhtmlファイルに置くと、すべてのテキストが表示されます。 class属性は設定されていませんが、すべてがstyle属性に格納されています。誰もがタグとスタイリングを削除していることを知っていますか?それはGmailですか、それとも私が紛失しているものですか?PHPメールフォーマット

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> 
+0

コードを投稿するのはどうですか? – nickb

+0

あなたはマルチパート分離をしていないようですね。あなたの質問を編集してコードを追加してください。 –

+0

プレーンテキストメールを送信しようとしましたか...同じ状況ですか? – mlinuxgada

答えて

1

電子メールのスタイルは非常に限られていますが、受け入れられるルールはほとんどなく、通常はインラインスタイルに設定されています。

HTML形式の電子メールテンプレート:電子メールでの

CSSのサポート:そう、私に知らせた場合、私は、質問を誤解している場合http://www.campaignmonitor.com/css/

申し訳ありません。

0

私はRFC 2822によると、別のメールクライアントやウェブメールは異なり、それを解釈するので、これは、原因であるが、あなたのメールは間違いなく無効であることをを知りません。あなたはある時点で問題に遭遇する可能性が高いです。本体内の文字の

  • 行は998文字、 に制限されなければならないとCRLFを除いて、78文字に制限されるべきです。

私は1494文字の長であるとして、あなたのHTMLの行を数えるので、あなたは、少なくとも2行にそれをラップする必要があります。

通常、80文字(CRLFを含む)の行が表示されますが、これは主に表示用です(コンピュータモニターの解像度が大幅に低下したときに戻っています)。 1000文字(CRLFを含む)の制限がはるかに重要です。

また、各行を区切るのにCRLFを使用していることを確認してください。

0

申し訳ありませんが、私は馬鹿だった、私はstyle="の間、あなたは3Dが書き込ま持っている必要があることを忘れていました。今、美しく動作します。