从 LINQ 列表发送电子邮件多个附件

发布于 2025-01-03 07:03:42 字数 413 浏览 4 评论 0原文

这对你们大师来说可能很简单,但我对此感到困惑。我有一种方法可以收集电子邮件的所有信息,然后通过 Outlook 发送出去。但是,我想考虑多个附件。我该怎么做呢?我需要在方法标头中更改哪些内容?

public static void sendOutlookMail(string toAddress, string emailSubject, string ccAddress = null, string emailAttachment = null, string emailBody = null)

我知道我必须更改,但不确定更改什么并保留默认值:

string emailAttachment = null

提前致谢。

如果您需要更多详细信息,请告诉我。

This might be very simple for you Gurus but I'm stumped on this. I have a method that will gather all the info for an email and then send it out via outlook. However, I want to account for multiple attachments. How would I do that? What do I need to change in my method header?

public static void sendOutlookMail(string toAddress, string emailSubject, string ccAddress = null, string emailAttachment = null, string emailBody = null)

I know that I have to change, but not sure to what and keep a default value:

string emailAttachment = null

Thanks in advance.

Please let me know if you need more details.

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

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

发布评论

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

评论(2

夕色琉璃 2025-01-10 07:03:42

如果你想传递字符串列表,你可以将其替换

     string emailAttachment = null

为:

    List<string> emailAttachment = null

If you want to pass list of string you can replace this:

     string emailAttachment = null

with this:

    List<string> emailAttachment = null
北凤男飞 2025-01-10 07:03:42

理想情况下你应该将其更改为

List<System.Web.Mail.MailAttachment>

希望有帮助

ideally you should change that to

List<System.Web.Mail.MailAttachment>

Hope that helps

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