Gmail E- mail signature not showing up in OutLook

2019-09-20 23:52发布

问题:

i created an E- mail signature in Html and copied the Browser output in Gmail Signature tab, it is working fine for Gmail to gmail, or Gmail to yahoo.

But when i open the mail in Outlook in my desktop, the logo is not showing up, i tried using html table as said here,

My HTML markup:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>    
<body>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>

<tr>    
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: #000000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">
Best Regards,</span><br><br>    
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;">
<span style="text-align: left; color: #000000; font-family: 'Arial', sans-serif; font-size: 13pt; font-weight: bold">Mr. Xyz</span>    
<td style="text-indent: -12.0em;">
<span style="text-align: right; margin-top: 0px; margin-bottom: 0px; color: #000000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">Email:  
xyz@something.com</span>
</td>    
</td>
</tr>


<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;">    
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: #000000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">IT
Development Manager</span>  
<td style="text-indent: -12.0em;">
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: #000000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">Ph No:  
123456</span>    
</td>    
</td>
</tr>

<tr>
<td valign="top" style="padding-left: 0px; padding-top: 7px; padding-bottom: 4px; padding-right: 0px;">
<a href="http://www.example.com/"><img src="http://imgur.com/ZQhgPvj" nosend="1" border="0" alt="E Design" title="xyz.com"></a>
</td>
</tr>

<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;">    
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: #000000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">Address Line 1,
</span><br>    
</td>
</tr>




<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;">
<br>
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: #0000; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">
Address Line 2.
</span>
</td>
</tr>


<tr>
<td valign="top" style="padding-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-right: 0px;">
<br>
<span style="text-align: left; margin-top: 0px; margin-bottom: 0px; color: green; font-family: 'Arial', sans-serif; font-weight: normal; font-size: 9pt;">
Please consider the environment before printing this e-mail.!
</span>
</td>
</tr>

</tbody>
</table>
</body>
</html>

Expected Output:

May i know what i am doing wrong ?

Any help would be great.

回答1:

Outlook uses Word as an email editor. You can read about supported and unsupported HTML elements, attributes, and cascading style sheets properties in the following articles in MSDN:

  • Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 1 of 2)
  • Word 2007 HTML and CSS Rendering Capabilities in Outlook 2007 (Part 2 of 2)

img src=" "

You need to add a reference to an image loaded to any web server or add an image as a hidden attachment. So, the result markup should look like the following one:

img src="cid:attachmentName"

  1. Add the attachment using the Attachments.Add method.
  2. Set the PR_ATTACH_CONTENT_ID property using the PropertyAccessor object.
  3. Set the cid value (see #2) for the reference in the message body.
      string img = "<br/><p><o:p><img src=\"" + att.FileName
         + "\" width=1 height=1 border=0 /></o:p></p>";
      item.HTMLBody = item.HTMLBody.Replace("</body>", img + "</body>");
      string PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E";
      string HIDDEN_ATTACHMENT = "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B";
      var pa = att.PropertyAccessor;
      if (pa != null)
      {
         pa.SetProperty(PR_ATTACH_CONTENT_ID, att.FileName);
         pa.SetProperty(HIDDEN_ATTACHMENT, false);
      }