C# SMTPClient sending attachment which locates in a url
In C#,How can i add an attachment which locates in a remote url(Ex:http://www.mydomain.com/attahments/sample.p开发者_开发知识库df) ?
I dont see that kind of overload for Attachment class constructor.
Any thoughts ?
You could download the file to your local system using one of the Download*
methods of the System.Net.WebClient class, and then attach it to your mail message.
I don't know how to attach the response stream of the webclient to the mailmessage attachment directly without saving the file to disk. Should be possible, although not according to this resource.
精彩评论