c# 发送到附件的电子邮件对象
我正在尝试从一个列表列表对象创建并发送电子邮件附件。我找到了一个记录良好的答案 在这里,但仍然有一些困惑。
它提到“获取一些二进制数据”,
//Get some binary data
byte[] data = GetData();
我已经通过以下方式测试了我的数据:
Console.WriteLine(ieLog.FirstName + "." + ieLog.LastName);
我想我的问题是,如果它还不是流,那么如何将其转换为流,然后使用:
//save the data to a memory stream
MemoryStream ms = new MemoryStream(data);
然后发送附件?
感谢您的任何帮助或提示。
如果我无法弄清楚,我想成为 Excel 文档或 csv。我确信已经有此类内容的课程,新手在哪里寻找此类信息?
I'm trying to create and send an email attachment from an object which is a list of lists. I found a nicely documented answer here, but still have some confusion.
It mentions "get some binary data"
//Get some binary data
byte[] data = GetData();
I have tested my data by:
Console.WriteLine(ieLog.FirstName + "." + ieLog.LastName);
I guess my question is how do I turn that into a stream if it isn't already one and then use:
//save the data to a memory stream
MemoryStream ms = new MemoryStream(data);
and then send the attachment?
Thank you for any help or hints.
I would like to be an excel doc or csv if I can't figure that out. I'm sure there are already classes for this sort of thing, where does a newb look for that sort of information?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是直接在浏览器中写的,不过应该没问题:
I wrote it directly in the browser, but it should be ok: