使用.eml进行HTML邮件签名

时间:2014-08-20 19:27:19

标签: email outlook base64 html-email multipart

理想情况下,对于Outlook Mail(windows)中的HTML邮件签名,我们使用.htm文件并将该文件放在文件夹Users\UserName\AppData\Roaming\Microsoft\Signatures

让我们假设:

HTML标记:

<img src="someImage">

要将图片作为附件嵌入,我必须使用cid以便

HTML标记更改为:

<img src="cid:0123456789">

由于此图像引用了multipart / related中的某个cid。 所以引用的部分就是这样的,即

--boundary
Content-Type: image/png; name="sig.png"
Content-Disposition: inline; filename="sig.png"
Content-Transfer-Encoding: base64
Content-ID: <0123456789>
Content-Location: sig.png

base64 data

--boundary

现在我的问题是我将把上面的多部分/相关(引用)代码放在哪个地方?

在同一个HTML文件中?像这样?

From HTML5 <html5@example.com>
From: HTML5 <html5@example.com>
To: HTML5 <html5@example.com>
Subject: =?utf-8?B?SFRNTDUgRW1haWw=?=
Date: Sat, 20 Dec 2008 04:07:13 -0500
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="mixed-boundary"

--mixed-boundary
Content-Type: multipart/alternative; boundary="alternative-boundary"

--alternative-boundary
Content-Disposition: inline; filename*=UTF-8''html5_email.txt
Content-Type: text/plain; format=flowed; delsp=yes; charset=UTF-8; name*=UTF-8''html5_email.txt
Content-Transfer-Encoding: 8bit

Note: This email is an HTML-based email. However, your client doesn't support HTML or you have HTML display 

turned off. Below is a text/plain alternative of the HTML version.

*HTML5 Email*

[Green square]

-- 
HTML5 [Christmas tree with blinking lights]
--alternative-boundary
Content-Type: multipart/related; boundary="related-boundary"

--related-boundary
Content-Disposition: inline; filename*=UTF-8''html5_email.html
Content-Type: text/html; charset=UTF-8; name*=UTF-8''html5_email.html
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <title>HTML5 Email</title>
        <link rel="stylesheet" type="text/css" href="html5_email.css">
    </head>
    <body>
        <h1>HTML5 Email</h1>
        <p><img src="html5_email.png" alt="Green square"></p>
        <p class="sig">--<br>HTML5 <img src="tree.gif" alt="Christmas tree with blinking lights"></p>
    </body>
</html>
--related-boundary
Content-Disposition: inline; filename*=UTF-8''html5_email.css
Content-Type: text/css; charset=UTF-8; name*=UTF-8''html5_email.css
Content-Transfer-Encoding: 8bit
Content-Location: html5_email.css

@charset="UTF-8";

p, h1 {
    text-align: center;
    border: 2px solid #000
}
p.sig {
    border: 0;
    text-align: left;
    color: #f00;
}
p.sig img {
    vertical-align: top;
}
--related-boundary
Content-Disposition: inline; filename*=UTF-8''html5_email.png
Content-Type: image/png; name*=UTF-8''html5_email.png
Content-Transfer-Encoding: Base64
Content-Location: html5_email.png

iVBORw0KGgoAAAANSUhEUgAAAUAAAADwCAIAAAD+Tyo8AAAABGdBTUEAALGPC/xh
BQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAA
OpgAABdwnLpRPAAAAgpJREFUeNrt00EJAAAIwMBFN7od/AkHl2CwmoCvJAADAwYG
DAwGBgwMGBgwMBgYMDBgYDAwYGDAwICBwcCAgQEDAwYGAwMGBgwMBgYMDBgYMDAY
GDAwYGDAwGBgwMCAgcHAgIEBAwMGBgMDBgYMDAYGDAwYGDAwGBgwMGBgwMBgYMDA
gIHBwICBAQMDBgYDAwYGDAwYGAwMGBgwMBgYMDBgYMDAYGDAwICBAQODgQEDAwYG
AwMGBgwMGBgMDBgYMDAYGDAwYGDAwGBgwMCAgQEDg4EBAwMGBgMDBgYMDBgYDAwY
GDAwYGAwMGBgwMBgYMDAgIEBA4OBAQMDBgYkAAMDBgYMDAYGDAwYGDAwGBgwMGBg
MDBgYMDAgIHBwICBAQMDBgYDAwYGDAwGBgwMGBgwMBgYMDBgYMDAYGDAwICBwcCA
gQEDAwYGAwMGBgwMBpYADAwYGDAwGBgwMGBgwMBgYMDAgIHBwICBAQMDBgYDAwYG
DAwYGAwMGBgwMBgYMDBgYMDAYGDAwICBAQODgQEDAwYGAwMGBgwMGBgMDBgYMDAY
GDAwYGDAwGBgwMCAgQEDg4EBAwMGBgMDBgYMDBgYDAwYGDAwYGAwMGBgwMBgYMDA
gIEBA4OBAQMDBgYMDAYGDAwYGAwMGBgwMGBgMDBgYMDAYGDAwICBAQODgQEDAwYG
DAwGBgwM3C2f1QjLwtmLSAAAAABJRU5ErkJggg==
--related-boundary
Content-Disposition: inline; filename*=UTF-8''tree.gif
Content-Type: image/gif; name*=UTF-8''tree.gif
Content-Transfer-Encoding: Base64
Content-Location: tree.gif

R0lGODlhKAA8AIMLAAD//wAhAABKAABrAACUAAC1AADeAAD/AGsAAP8zM///AP//
///M//////+ZAMwAACH/C05FVFNDQVBFMi4wAwGgDwAh+QQJFAALACwAAAAAKAA8
AAME+3DJSWt1Nuu9Mf+g5IzK6IXopaxn6orlKy/jMc6vQRy4GySABK+HAiaIoQdg
uUSCBAKAYTBwbgyGA2AgsGqo0wMh7K0YEuj0sUxRoAfqB1vycBN21Ki8vOofBndR
c1AKgH8ETE1lBgo7O2JaU2UFAgRoDGoAXV4PD2qYagl7Vp0JDKenfwado0QCAQOQ
DIcDBgIFVgYBAlOxswR5r1VIUbCHwH8HlQWFRLYABVOWamACCkiJAAehaX0rPZ1B
oQSg3Z04AuFqB2IMd+atLwUBtpAHqKdUtbwGM1BTOgA5YhBr374ZAxhAqRVLzA53
OwTEAjhDIZYs09aBASYq+94HfAq3cRt57sWDct2EvEsTpBMVF6sYeEpDQIFDdo62
BHwZApjEhjW94RyQTWK/FPx+Ahpg09GdOzoJ/ESx0JaOQ42e2tsiEYpCEFwAGi04
8g6gSgNOovD0gBeVjCPR2BIAkgOrmSNxPo3rbhgHZiMFPnLkBg2BAuQ2XdmlwK1Z
ooZu1sRz6xWlxd4U9GIHwOmdzFgCFKCERYNoeo2BZsPp0KY+A/OAfZDYWKJZLZBo
1mQXdlojvxNYiXrD8I+2uEvTdFJQksID0XjXiUwjJm6CzBVeBQgwBop1ZPpC8RKt
YN5RCpS6XiyMht093o8KcFFf/vKE0dCmaLeWYhQ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G12JAmpHicaU3QDPe6fHjoSAQDlIBY6leDIUD
dnp9C04DdXh3eAaEUTeKdwJRagUCBGdnW3JHmJh8XHNmWAeLDwCfRQIBA6MMiQMG
AgBcBgGSUgeuWQMAvb1MAgWruXAMrJYAUkU2wVGXDGZeAIxMCgVfaJhOVkB/PWeX
nXM5AnScSKR2dmZzqCwFUAKjo1l4XpLULNuwWXYHAHgWCYD15AXBgV+wEACg7sDA
A45oaLFy5ZKvXvYMEPCGYvvOwQOYAHRCQufFuU7/wp2Zo2AKCgPtwN3xR8/LLpcg
kg1khaVlQyw8GRAwlC8nvp2HeM5UR8CYxp05L8ay8YcplmLGtmniwCtKLFhJR9oR
amnAuBAiH9wK9G1kAgaxBCg5u6HdSUzp1LlNCqJAgZGBaC41Q6DAUAUfajm5ZUdK
v7z08ATjmKGWAltecaVTqE5oFisB/EIpSiH06IcKpQTa3JSVagPCWm7wZsgOwJkg
3xaTrJFkFgvtFHDywmt1J2iB2pC0C9x0yItnsLx1K8xdoQDYCcQ9I5KwaynaalUS
RnpBpYH4YiXoTipgIlIFtLSUFKwSBb/NtGCnb2Zl51fHo8hnhRZbSfCEKkgZkkcw
TgBgyVdxeQNRMNNMoMBOpBxFUSx+ObgYPgS1BBRss/jxxzwAqsbLRfwh1VJyF5WI
2AkIAIAAAiiUKMGMICDRXQIn6IiCW4Qs4NYZTByppBkbRAAAIf4ZQm95J3MgSGFw
cHkgSG9saWRheXMgUGFnZQA7
--related-boundary--
--alternative-boundary--

--mixed-boundary
Content-Disposition: attachment; filename*=UTF-8''example1.txt
Content-Type: text/plain; charset=UTF-8; name*=UTF-8''example1.txt
Content-Transfer-Encoding: 8bit

ï
--mixed-boundary
Content-Disposition: attachment; filename*=UTF-8''example2.txt
Content-Type: text/plain; charset=UTF-8; name*=UTF-8''example2.txt
Content-Transfer-Encoding: 8bit

ZipZamBam
--mixed-boundary--

但是以这种方式将HTML与多部分结合使用会导致.eml而不是.html?有人可以帮帮我吗?

我绝对是新手。

1 个答案:

答案 0 :(得分:0)

图像文件转到子文件夹。查看使用映像的现有Outlook签名。