Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi iam getting the following error.
invalid attahment like"C:\\readme.txt".

my application is working with IE.
but it does n't work with Mozilla.
how can i rectify this error.

code:


MailMessage msgMail = new MailMessage();
        msgMail.To = TextBox3.Text;
        msgMail.From = "abc@gmail.com";
        msgMail.Subject = "Attachment Test";

        msgMail.BodyFormat = MailFormat.Text;
        msgMail.Body = "Name:" + txtName.Text + "\n" + "Designation:" +                                        DropDownList1.Value + "\n" + " Phone No:" + TextBox2.Text;
        String strPath = Path.GetFullPath(MyFile.PostedFile.FileName);
        msgMail.Attachments.Add(new MailAttachment(strPath));
        SmtpMail.Send(msgMail);
        Response.Write("Email was queued to disk");
Posted
Updated 28-Feb-11 19:34pm
v4

ASP.NET email with multiple attachments

I hope the above information will be helpful. If you have more concerns, please let me know.
 
Share this answer
 
You are trying to attach the file from the client machine it self...try to do the following

1. upload the file to a server location where the application has read permission.
2. use this file location for attachment.
 
Share this answer
 
Hi,

first of all save your file at desire location.
than get a file using sevrer.mappath from that location
 
Share this answer
 

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