如何在C#中发送电子邮件时附加文件 [英] How to attach a file in sending email in C#

查看:222
本文介绍了如何在C#中发送电子邮件时附加文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我为Web应用程序编写了C#代码,我可以使用SMTP服务器发送电子邮件。

如何添加多个附件并发送。

我是否需要使用fileupload或者还有其他东西吗?

请指教



谢谢,

Hi all,

I have written C# code for a web application where I can send emails using SMTP server.
How to add multiple attachments and send.
Do I need to use fileupload or is there something other than that?
Please advise

Thank you,

推荐答案

大家好,



我试过fileUpload并找到了解决方案。



Hi all,

I tried with fileUpload and found the solution.

mail.Attachments.Add(new Attachment(fileUpload.PostedFile.InputStream, fileUpload.FileName)); 





谢谢大家



Thank you all


这篇关于如何在C#中发送电子邮件时附加文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆