I have an ASP.NET web forms application that pulls email from an IMAP account. I am using an IMAP control from nsoftware IP*Works to pull the emails. In order to download and save the attachments one does this…
for (int part = 0; part < imaps1.MessageParts.Count; part++)
{
if (imaps1.MessageParts[part].FileName.Length > 0)
{
imaps1.LocalFile = "C:\\Users\\someguy\\Documents\\" + imaps1.MessageParts[part].FileName;
imaps1.FetchMessagePart(imaps1.MessageParts[part].Id);
}
}
But I don’t want it downloaded; I want the attachment to open.
How would I do that?
Thanks!
You need to save the attachment contents to
Response.OutputStreamrather than a file on disk.