如果我今天要寄一封 E-Mail,內文要有圖片,那整封信的內容可能如下:
Subject: This is a test mail!
From: test@example.com
Content-Type: multipart/mixed; boundary="qwertyuio"
--qwertyuio
Content-Type: text/html; name="example.html"
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Example</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
<img alt="" src="cid:28ce9652-4476-4e3c-8e9a-5d1bbae4cd05" />
</body>
</html>
--qwertyuio
Content-Type: image/jpeg; name="example.jpg"
Content-Disposition: attachment; filename="example.jpg"
Content-ID: 28ce9652-4476-4e3c-8e9a-5d1bbae4cd05
<image content>
--qwertyuio--