生成并附加文件到电子邮件。 [英] Generate and Attach a file to email.

查看:99
本文介绍了生成并附加文件到电子邮件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求是生成并附加文件并自动发送电子邮件。


i具有现有功能,我使用下面的代码在本地系统中写入CSV文件。


[HTML] StreamWriter sw = File.CreateText(fileName)[/ HTML]

[HTML] sw.Write(m_Model.Csv); [ / HTML]


新功能是将文件附加到电子邮件并自动发送。我无法存储在某个路径并附加,因为访问问题可能会在以后发生。


是否有其他方法可以生成CSV文件并附加到电子邮件。

解决方案

如果你想添加一个附件,你需要先创建文件 - 如果你不是那么你会附加什么?为什么不想先在服务器上创建文件呢?


B博士


我只是在考虑用户是否不会有写入权限保存文件在c:\或d:\ ....


可能我应该请求对特定文件夹的写访问权..

我们在这里谈论网站或Windows应用程序吗?


B博士


My requirement is to generate and attach a file and send in an email automatically.

i have a existing functionality where i using the code below to write a CSV file in my local system.

[HTML]StreamWriter sw = File.CreateText(fileName)[/HTML]
[HTML]sw.Write(m_Model.Csv);[/HTML]

the new functionality is to attach the file to email and send automatically. i cannot store in some path and attach since access issues might come later.

Is there any other way to generate the CSV file and attach to email.

解决方案

If you want to add an attachment then you need to create the file first - if you don''t then what would you be attaching? Why don''t you want to create the file on the server first?

Dr B


I was just thinking if the user will not have write access to save the file in the c:\or d:\....

May be i should request for write access to specific folder..


Are we talking about a website or a windows app here?

Dr B


这篇关于生成并附加文件到电子邮件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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