Shyju
Shyju

Reputation: 218832

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.pdf) ?

I dont see that kind of overload for Attachment class constructor.

Any thoughts ?

Upvotes: 1

Views: 1534

Answers (1)

Marijn
Marijn

Reputation: 10557

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.

Upvotes: 1

Related Questions