开发者

generating an html attachment vb.net

开发者 https://www.devze.com 2023-04-03 17:45 出处:网络
I am trying to generate a report html file and email it as an attachment with vb.net I know how send mail and attachments.

I am trying to generate a report html file and email it as an attachment with vb.net I know how send mail and attachments.

Do I need to generate the html file, save it as an .html file to the local disk where the program runs, then add its file path to the attachment property to send it to the recipient?

It is going to be a rather large report, and I would like to send it as an attachment instead of directly inside of the email i开发者_开发问答tself.

Thanks


Yes, you save the file to disk ant then add to the Attactments collection of the MailMessage. Here is the C# syntax to create an Attachment from a file on disk and add the attachment to the message. It will be similar for VB.Net.

Attachment att = new Attachment(filename);
message.Attachments.Add(att);
0

精彩评论

暂无评论...
验证码 换一张
取 消