更新时间:2021-10-13 02:23:47
您正在保存整个MIME对象(包括标题)。您需要做的就是保存内容。
You are saving the entire MIME object (including the headers). What you need to do is save the content.
foreach (var attachment in message.Attachments) {
using (var stream = File.Create ("fileName")) {
if (attachment is MessagePart) {
var part = (MessagePart) attachment;
part.Message.WriteTo (stream);
} else {
var part = (MimePart) attachment;
part.Content.DecodeTo (stream);
}
}
}
希望有帮助。