0 votes
by (160 points)
edited

I'm trying to make a Silverlight email client. Since there's no direct IMAP connection possible from silverlight, I've wrapped the email objects in objects. Attachments are the biggest challenge.

One thing I'm considering is having my silverlight application launch a browser window, specifying a message id and attachment, and trying to just kick in the standard browser download functionality.

Has anyone else written any asp.net email clients with these tools, or know what exactly I'd need to write?

Applies to: Rebex Secure Mail

1 Answer

+1 vote
by (17.7k points)
edited

Actually, this situation is not described in any Rebex MAIL sample, although something similar is used in samples for Rebex ZIP.

If I understand your problem well, the trick you are looking for is writing the attachment into HTTP Response stream. Core of the solution is shown in following code snippet:

Attachment attachment;

// ...retrieve the attachment from mail message...

Response.Clear();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + attachment.FileName);
attachment.Save(Response.OutputStream);
Response.End();
...