最先想到的就是outLook可以显示附件中的图片.于是在OutLook的邮件正文:右键->ViewSource 就看到了
1
" <img width&#61;560 height&#61;420 id&#61;"_x0000_i1025"
2
src&#61;"cid:image001.jpg&#64;01C8C4AF.C7E6ED20">"
这种代码 所以产生的第一个想法就是在写正文的时候,自动根据附件去生成类似代码.说干就干,马上动手!![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
2
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
新建一个网站,拖几个FileUpload 上去.如下图
![](https://img.php1.cn/3cd4a/1eebe/cd5/e88efe5b0a13a7fa.webp)
根据MicroSoft自带的System.Net.Mail 组件,完成发送方法,代码如下
1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
using System.Net.Mail;
5
using System.Net;
6
using System.IO;
7
namespace STS.MailSystem.Common
8![](https://img.php1.cn/3cd4a/18ace/696/1d8e759bd3e6bbec.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
{
9
public class QMail
10![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
11![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
/**////
12
/// 描述:Email发送通用函数
13
///
14
/// 发件人
15
/// 收件人(多个收件人以逗号隔开)
16
/// 主题
17
/// 内容
18
/// 附件
19
///
20
public string MailSend(string from, string to, string cc, string subject, string text, Attachment attch, string priority)
21![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
22
MailMessage message &#61; new MailMessage(from, to);
23
message.CC.Add(cc);
24
message.Subject &#61; subject;
25
message.Body &#61; text;
26
27![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
28
//message.CC.Add(new MailAddress(from)); //超送给自己
29
//message.Bcc.Add(new MailAddress(""));
30![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
31
if (attch !&#61; null)
32![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
33
Attachment data &#61; attch;
34
message.Attachments.Add(data);
35
}
36![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
37
message.BodyEncoding &#61; System.Text.Encoding.UTF8;//编码方式
38
switch (priority.ToUpper())
39![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
40
case "HIGH":
41
message.Priority &#61; MailPriority.High;//优先级
42
break;
43
case "NORMAL":
44
message.Priority &#61; MailPriority.Normal;//优先级
45
break;
46
case "LOW":
47
message.Priority &#61; MailPriority.Low;//优先级
48
break;
49
default:
50
message.Priority &#61; MailPriority.Normal;//优先级
51
break;
52
}
53
54
message.IsBodyHtml &#61; true;//是否是html格式
55
SmtpClient client &#61; new SmtpClient();//不同情况更改
56![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
57
//client.Credentials &#61; CredentialCache.DefaultNetworkCredentials;//匿名认证
58
59
60
try
61![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
62
client.Send(message);
63
return "1";
64
}
65
catch (Exception e)
66![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
67
68
return e.Message;
69
}
70
71
}
72![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
73
74![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
75
}
76
}
77![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
78![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
2
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
3
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
4
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
5
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
6
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
7
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
8
![](https://img.php1.cn/3cd4a/18ace/696/1d8e759bd3e6bbec.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
9
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
10
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
11
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
12
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
13
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
14
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
15
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
16
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
17
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
18
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
19
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
20
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
21
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
22
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
23
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
24
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
25
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
26
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
27
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
28
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
29
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
30
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
31
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
32
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
33
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
34
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
35
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
36
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
37
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
38
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
39
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
40
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
41
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
42
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
43
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
44
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
45
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
46
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
47
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
48
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
49
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
50
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
51
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
52
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
53
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
54
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
55
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
56
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
57
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
58
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
59
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
60
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
61
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
62
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
63
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
64
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
65
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
66
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
67
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
68
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
69
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
70
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
71
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
72
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
73
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
74
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
75
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
76
![](https://img.php1.cn/3cd4a/1eebe/cd5/0ef126b5295c089b.webp)
77
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
78
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
然后看看我们的前台代码
1
using System;
2
using System.Data;
3
using System.Configuration;
4
using System.Web;
5
using System.Web.Security;
6
using System.Web.UI;
7
using System.Web.UI.WebControls;
8
using System.Web.UI.WebControls.WebParts;
9
using System.Web.UI.HtmlControls;
10
using System.Net.Mail;
11
using STS.MailSystem.Common;
12
using System.Text;
13![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
14
public partial class _Default : System.Web.UI.Page
15![](https://img.php1.cn/3cd4a/18ace/696/1d8e759bd3e6bbec.jpeg)
{
16
protected void Page_Load(object sender, EventArgs e)
17![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
18![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
19
}
20
protected void Button1_Click(object sender, EventArgs e)
21![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
22
QMail mail &#61; new QMail();
23![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
24
Attachment attachment &#61; null;
25
//File Name
26
string fileName &#61; string.Empty;
27
string filePath &#61; string.Empty;
28
StringBuilder mailBody &#61; new StringBuilder();
29
//mailBody.Append("content-type:base64");
30
//mailBody.Append("content-transfer-encodinf:");
31
//mailBody.Append("content-disposition:inline");
32
//mailBody.Append("filename:aa");
33
//增加附件
34
//这里指去考虑附件是图片的情况.
35
//其他情况不考虑
36
if (File1.Value !&#61; "")
37![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
{
38
filePath &#61; this.File1.PostedFile.FileName;
39
fileName &#61; filePath.Substring(filePath.LastIndexOf("\\") &#43; 1);
40
//增加显示图片
41
mailBody.Append("content-id:" &#43; fileName);
42
mailBody.Append("
" &#43; fileName&#43;"&#39; />");
43
attachment &#61; new Attachment(filePath);
44
}
45![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
46![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
47
//Send Mail
48
mail.MailSend("minqiang.zhang&#64;metinform.cn", "minqiang.zhang&#64;metinform.cn",
49
"minqiang.zhang&#64;metinform.cn", "演示如果在正文显示附件", mailBody.ToString(), attachment, "");
50![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
51
}
52
}
53![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
54![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
2
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
3
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
4
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
5
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
6
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
7
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
8
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
9
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
10
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
11
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
12
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
13
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
14
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
15
![](https://img.php1.cn/3cd4a/18ace/696/1d8e759bd3e6bbec.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
16
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
17
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
18
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
19
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
20
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
21
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
22
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
23
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
24
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
25
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
26
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
27
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
28
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
29
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
30
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
31
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
32
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
33
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
34
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
35
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
36
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
37
![](https://img.php1.cn/3cd4a/94ce/a6e/865776f6fe3d5f59.jpeg)
![](https://img.php1.cn/3cd4a/1eebe/cd5/e62700fe09f8933e.webp)
![](https://img.php1.cn/3cd4a/1eebe/cd5/dc7ef30f57b727c7.jpeg)
38
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
39
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
40
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
41
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
42
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
43
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
44
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
45
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
46
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
47
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
48
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
49
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
50
![](https://img.php1.cn/3cd4a/1eebe/cd5/ff61bfdd3c0af92e.webp)
51
![](https://img.php1.cn/3cd4a/1eebe/cd5/d05d9dfd09a56332.webp)
52
![](https://img.php1.cn/3cd4a/1eebe/cd5/0ef126b5295c089b.webp)
53
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
54
![](https://img.php1.cn/3cd4a/1eebe/cd5/617c1173853af4b6.webp)
写完之后,点击发送,我靠!真的可以也.
代码其实很简单我们来总结一下:
这里最重要的东西是在正文中如何使用Img显示附件中的图片,从代码中我们可以看到content-id:附件中图片名字的方案解决的.
以上是自己方法,如果谁有更好的方法请贴出来,大家共享!
声明:由于代码是简单测试是否可以在附件中显示附件,所以代码写的很乱.大家看思路就行了.