2015-11-27 35 views
11

我有一封電子郵件,如下所示。問題是,它在Gmail上運行正常,但在Outlook中,所有CSS內聯語句都不起作用。Outlook軟件去掉電子郵件中的內聯CSS

一個例子是:

<a href="https://www.facebook.com/BePureApparel" target="_blank"><img style="width: 35px;" src="{img_dir}fb.png" /></a> 

//The image width is stripped out and the original size is used to display 

是否有這方面的任何修復?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
    <title>Welcome to Pure Apparel</title> 
</head> 
<body> 
    <table class="table table-mail" style="width: 100%; margin-top: 10px; -moz-box-shadow: 0 0 5px #afafaf; -webkit-box-shadow: 0 0 5px #afafaf; -o-box-shadow: 0 0 5px #afafaf; box-shadow: 0 0 5px #afafaf; filter: progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5);"> 
<tbody> 
<tr> 
<td class="space" style="width: 20px; padding: 7px 0;">&nbsp;</td> 
<td align="center" style="padding: 7px 0;"> 
<table class="table" bgcolor="#ffffff" style="max-width: 650px; width: 100%; border-collapse: collapse; margin: auto;"> 
<tbody> 
<tr> 
<td colspan="2" align="center" class="logo" style="padding: 7px 0;"><a title="{shop_name}" href="{shop_url}" style="color: #337ff1;"> <img src="{shop_logo}" alt="{shop_name}" /> </a></td> 
</tr> 
<tr> 
<td colspan="2" align="center" class="titleblock" style="border-bottom: 1px solid #636566; border-top: 1px solid #636566; padding: 7px 0;"><a href="{shop_url}56-new-in" style="font-weight: 500; font-size: 17px; line-height: 26px; width: 25%; float: left; color: #555454; text-decoration: none;">New-In</a> <a href="{shop_url}23-women" style="font-weight: 500; font-size: 17px; line-height: 26px; width: 25%; float: left; color: #555454; text-decoration: none;">Women</a> <!--<a href="{shop_url}40-men" style="font-weight:500;font-size:17px;line-height:26px;width:20%;float:left;color:#555454;text-decoration:none;">Men</a>--> <a href="{shop_url}content/7-fw15" style="font-weight: 500; font-size: 17px; line-height: 26px; width: 25%; float: left; color: #555454; text-decoration: none;">Lookbook</a> <a href="http://pureapparel.me/" style="font-weight: 500; font-size: 17px; line-height: 26px; width: 25%; float: left; color: #555454; text-decoration: none;">Be-pure blog</a></td> 
</tr> 
<tr> 
<td colspan="2"><a href="{shop_url}content/24-international-shipping"><img style="width: 100%; display: block;" src="{img_dir}en/welcome.jpg" /></a></td> 
</tr> 
<tr style="border-bottom: 1px solid #636566; text-align: center;"> 
<td style="padding: 10px 0px;"> 
<h3 style="margin-top: 5px;">New Collection</h3> 
<p>Enjoy online shopping with our easy check out process and reliable door to door courier service.</p> 
<a style="display: block; text-align: center; width: 100px; color: #ffffff; background-color: #58595b; padding: 8px; margin: auto; margin-bottom: 5px; text-decoration: none;" href="{shop_url}" target="_blank">Shop now</a></td> 
<td style="padding: 10px 0px;"><img style="width: 200px;" src="{img_dir}box1.jpg" /></td> 
</tr> 
<tr style="border-bottom: 1px solid #636566; text-align: center;"> 
<td style="padding: 10px 0px;"><img style="width: 200px;" src="{img_dir}box2.jpg" /></td> 
<td style="padding: 10px 0px;"> 
<h3>be-pure blog</h3> 
<p>With access to our be-pure blog, be the first to know about our newest design, latest yoga & fitness trends and community events.</p> 
<a style="display: block; text-align: center; width: 100px; color: #ffffff; background-color: #58595b; padding: 8px; margin: auto; text-decoration: none;" href="http://pureapparel.me/" target="_blank">View blog</a></td> 
</tr> 
<tr style="border-bottom: 1px solid #636566;"> 
<td colspan="2" style="padding: 10px 0px;"> 
<h3>Have a Question?</h3> 
<div style="width: 100%; text-align: center;"><img style="width: 120px; margin-right: 10px;" src="{img_dir}en/q1.jpg" /> <img style="width: 120px; margin-right: 10px;" src="{img_dir}en/q2.jpg" /> <img style="width: 120px;" src="{img_dir}en/q3.jpg" /></div> 
</td> 
</tr> 
<tr style="text-align: center;"> 
<td colspan="2"> 
<p>Stay connected with us</p> 
<div><a href="https://www.facebook.com/BePureApparel" target="_blank"><img style="width: 35px;" src="{img_dir}fb.png" /></a> <a href="https://twitter.com/be_pureapparel" target="_blank"><img style="width: 35px;" src="{img_dir}tw.png" /></a> <a href="http://instagram.com/be_pureapparel" target="_blank"><img style="width: 35px;" src="{img_dir}ig.png" /></a></div> 
<p>Please add <a style="text-decoration: none; color: #58595b;" href="mailto:[email protected]">[email protected]</a> to your approved senders or address book.</p> 
<p>If you do not wish to receive any eNews, please click here to update your preferences or <a href="{my_account_url}" style="color: #58595b;">unsubscribe</a> from this list</p> 
</td> 
</tr> 
<tr> 
<td colspan="2"> 
<p style="float: left; text-align: center; width: 25%;">@2015 Pure Retail Ltd.</p> 
<p style="float: left; text-align: center; width: 25%;"><a href="{shop_url}" style="text-decoration: none; color: #58595b;">www.be-pure.com</a></p> 
<p style="float: left; text-align: center; width: 25%;"><a href="{shop_url}content/3-terms-and-conditions-of-use" style="text-decoration: none; color: #58595b;">Terms & Conditions</a></p> 
<p style="float: left; text-align: center; width: 25%;"><a href="{shop_url}content/15-privacy-policy" style="text-decoration: none; color: #58595b;">Privacy Policy</a></p> 
</td> 
</tr> 
</tbody> 
</table> 
</td> 
<td class="space" style="width: 20px; padding: 7px 0;">&nbsp;</td> 
</tr> 
</tbody> 
</table> 
</body> 
</html> 

其實,源代碼不會刪除CSS,但瀏覽網頁時,Outlook作爲如果CSS被剝離出來,任何想法的行爲?

更新(29/11/2015):

於是,我終於發現了width:50px不工作,我必須使用width="50"的大小來控制,因爲我只需要支持Outlook 2013和以後的版本,我想知道:

  1. 這是真的,Outlook 2013中不上IMG標記支持內嵌CSS像width:50px

  2. 如果確實支持它,問題出在電子郵件服務器上嗎?

  3. 有沒有更簡單的方法將我的模板轉換爲支持Outlook 2013?

+0

所有內聯樣式都被剝離了嗎? – holden

+0

稍等片刻,我會發布電子郵件的源代碼感謝 – user3538235

+0

已更新,請花費很多,感謝您的幫助。 – user3538235

回答

8

Outlook使用不同的方式執行樣式表。不是SMTP設置或電子郵件設置。這取決於Gmail,Outlook和Yahoo等電子郵件服務如何顯示CSS。 Outlook風格如何= IE風格如何。

我已經使用Mailchimp爲我使用的每個p元素執行此操作,並且它在Outlook和Gmail中看起來不完全相同,但是距離我可以最近。

<p class="MsoNormal" style="text-align:justify; line-height:150%; font-family:Arial, Helvetica, sans-serif;"> 

我用於Outlook的指南是這樣的。請注意,您必須加入他們的社區(免費)才能獲得Outlook指南,我認爲這是值得的,併爲您節省麻煩。 https://www.emailonacid.com/resources

上一個鏈接應該向您解釋,但如果您需要更多信息,您可以隨時查看我以前使用的以下兩個鏈接。

對於Outlook/Hotmail的,他們通常在造型的前一個mso語法像 http://templates.mailchimp.com/development/css/outlook-conditional-css/

對於某些元素的電子郵件提供商使用,可以參考這裏。 https://www.campaignmonitor.com/css/

花一些時間創建適用於所有電子郵件服務的電子郵件模板,並在下次修改它以滿足您的需求時比從頭開始節省更多的時間和精力。

+0

到目前爲止它不支持填充,邊距,高度,寬度,噢我的上帝 – user3538235

+0

我想創建一個帶填充和背景顏色的按鈕,但它不起作用 – user3538235

+2

你有按鈕的代碼嗎?填充可能有一些問題,如果按鈕中有文本,可能會導致一些行高問題。 – cweitat

1

Outlook不會忽略內聯樣式。雖然它不理解相當多的CSS屬性。今天我們認爲理所當然的事情是:浮動,利潤,填充。 Campaign Monitor有一個很好的table of which things will work in which email clients

你幾乎總是可以用很多很多的嵌套表來解決這個問題。這很醜陋,但它是跨平臺的,這就是最重要的。

有時在電子郵件營銷中,您必須接受,它不會在每個電子郵件客戶端和看起來100%相同,這沒關係。只要在每個客戶端上看起來,這裏和那裏是否有2px的額外空間並不重要。

電子郵件營銷通常是關於漸進式增強。您儘可能地爲使用Lotus Notes和其他舊客戶的人員提供最好的服務,併爲在Chrome上使用Gmail的人員添加收尾。例如,即使Outlook不支持媒體查詢,您仍可以(也可能應該)使用它們,因爲其他客戶端會這樣做。這很好,如果一個電子郵件客戶端支持媒體查詢,他們也可能支持更多現代化的東西,比如浮動,所以如果你願意,你可以在媒體查詢中使用類似的屬性。

CSS技巧有一篇相當不錯的文章,它討論了general sort of methodology you should follow


寫HTML電子郵件在很大程度上是一個問題的經驗。做得足夠多,你會發現與編寫網頁相比,你必須做不同的事情。我強烈建議您通過Litmus來測試您所做的任何事情,尤其是在您爲客戶創作作品時。它將向您展示您的電子郵件在幾乎所有電子郵件客戶端中的呈現方式這是一項訂閱服務 - 而且價格昂貴 - 但實際上沒有任何可比的免費服務。