Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

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

My code is given below.

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


Received it's name but sensding as 0 bytes.

How can i solve it.

please help me..

Thanks in advance,
Vineeth@
Posted
Comments
Vineetha Ravindranath 12-Jan-15 4:54am    
Attachment received but showing as
"This attachment appears to be empty.
Please check with the person who sent this.
Often company firewalls or antivirus programs will destroy attachments".

but antivirus or firewalls not blocking. we have checked. Text Document canbe received.not receiving pdf and images.

As uploaded file is temporary one, you might encounter such situations - or you need to do some work. Use this approach instead: http://imar.spaanjaars.com/412/sending-attachments-directly-from-a-fileupload-control[^]
 
Share this answer
 
Comments
Vineetha Ravindranath 12-Jan-15 4:55am    
I followed it. still have problems..
Zoltán Zörgő 12-Jan-15 5:42am    
Use a network sniffer (whireshark or microsoft network monitor) and check what's actually sent.
can u try this.
C#
if (FileUpload1.HasFile)//Attaching document
                  {
                      string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                      message.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
                  }
 
Share this answer
 
Comments
Vineetha Ravindranath 12-Jan-15 4:29am    
yes. I did same thing. But still have error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900