C# SMTPClient 发送位于 url 中的附件

发布于 2024-10-07 04:54:57 字数 125 浏览 0 评论 0 原文

在 C# 中,如何添加位于远程 url 中的附件(例如:http://www.mydomain.com/attahments/sample.pdf)?

我没有看到附件类构造函数的那种重载。

有什么想法吗?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青春如此纠结 2024-10-14 04:54:57

您可以使用 Download* 方法之一将该文件下载到本地系统。 webclient.aspx" rel="nofollow">System.Net.WebClient 类,然后将其附加到您的邮件中。

我不知道如何将网络客户端的响应流直接附加到邮件消息附件而不将文件保存到磁盘。应该是可能的,尽管不是根据此资源

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文