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

I want to send mail adding attachments from datagridview. Datagridview contains 4 xml files, all those files i want to send mail by adding attachments.

Thanks
Praveen
Posted
Comments
[no name] 24-Apr-13 9:19am    
So add the attachments to your email message before you send it.

1 solution

...
mail.Body = txtComments.Text;
//Attach file
mail.Attachments.Add(new Attachment(txtAttachments.Text.ToString()));
mail.Attachments.Add(new Attachment(txtAttachments2.Text.ToString()));
mail.Attachments.Add(new Attachment(txtAttachments3.Text.ToString()));
mail.Attachments.Add(new Attachment(txtAttachments4.Text.ToString()));
SmtpServer.Port = 587;
 
Share this answer
 
Comments
praveen_fds 24-Apr-13 9:49am    
thanks rohit, i want to send mail by selecting cell in gridview. attachments should be same format(.xml)

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