1
我上传图像到一个asp.net网站使用fileupload,我需要通过电子邮件发送上传的图像做到这一点,我将图像保存到文件夹在erver上,然后我发送的图像,但我可以发送它没有将其保存到文件夹之前,或者如果我需要将其保存到文件夹,我可以删除它,只要它被发送? 谢谢。如何通过电子邮件发送图像,而不保存到文件夹
我的代码:
string filename = Path.GetFileName(file.FileName);
file.SaveAs(Server.MapPath("UploadImages/" + filename));
string attachmentPath = Server.MapPath("UploadImages/" + filename);
Attachment inline = new Attachment(attachmentPath);
inline.ContentDisposition.Inline = true;
inline.ContentDisposition.DispositionType = DispositionTypeNames.Inline;
inline.ContentType.Name = Path.GetFileName(attachmentPath);
mail.Attachments.Add(inline);