本文介绍了如何用pdf发送邮件,图像作为附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我可以发送带附件的邮件。但收到0个字节。



我的代码如下:





I can sent mail with attachment. But received 0 bytes.

My code is given below.

if (FileUpload1.HasFile)
{
string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
Attachment attachment = new Attachment(FileUpload1.FileContent, FileName);
mm.Attachments.Add(mailAttach);
}





收到它的名字,但感觉为0字节。



我该如何解决呢。



请帮帮我..



在此先感谢,

Vineeth @



Received it's name but sensding as 0 bytes.

How can i solve it.

please help me..

Thanks in advance,
Vineeth@

推荐答案


if (FileUpload1.HasFile)//Attaching document
                  {
                      string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                      message.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
                  }


这篇关于如何用pdf发送邮件,图像作为附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 12:20