MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.Subject = "Weekend Plans";
foreach(var image in productImage)
{
Attachment attachment = new Attachment(image.Image);
attachment.TransferEncoding = TransferEncoding.Base64;
mail.Body = image.Comments;
mail.Attachments.Add(attachment);
Getting exception.
System.IO.PathTooLongException: 'The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters
How to handle exception?

Ronika JencyRank #770 · 3K reputationPosted Jan 20, 2020, 9:12 AM EST
Varnaparan DRank #9,790 · 202 reputationPosted Jan 20, 2020, 10:19 AM EST
Tom Murphy7 reputationPosted May 19, 2020, 11:06 PM EDT