开发者

What is an efficient way to send email with possibly multiple large attachments via a WCF web service?

I am looking for the best (or at least a very good) way of doing the following:

The client passes the necessary data (i.e. from, to, cc...subject, body etc) as well as attachment files to the service which composes the email using the SmtpClient class and sends it to the recipient(s).

I know how to send an email with the aforementioned fields passed by the client, however I am having difficulty with the attachments, as they could potentially be more than 1 large files of any type. Is it better for the client to pass a Stream object, a byte[] (or possibly a 2D array for >1 attachments) etc. to the service?

Are there are conventions or p开发者_如何学Pythonrotocols for this topic? (I'm writing a WCF web service in C#)

Any advice, code, links, etc would be appreciated...


You could use MTOM (Message Transmission Optimization Mechanism) to pass the attachment as binary content. Here is a good writeup: http://weblogs.asp.net/ricardoperes/archive/2009/05/14/using-mtom-with-wcf.aspx


I would send the outgoing emails to a pickup directory, which will queue them instead of sending them immediately.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜