STEP 1 - MUST define server valid path
you should apply a valid and EXISTING !! folder on the SERVER from where to get the attach file. Usually this is the Upload folder path.

you should get it that way :
string ValidServerPath = Server.MapPath(string.Empty) + @"\" + UPLOAD_FOLDER + @"\";

STEP 2 - Get the valid path for the attach file
supply the attach file name and concat it to that path, like that :
string validServerFilePath = ValidServerPath + sAttachedFileName;

STEP 3 - Set encoding - IMPORTANT !!
you have to set the mail encoding to handle all types of extentions (.doc, .txt, .jpg ...)
to do that, create the MailAttachment object like that :
MailAttachment fileAttachment = new MailAttachment(validServerFilePath, MailEncoding.UUEncode);

STEP 4 - Attach the file to the message
myMsg.Attachments.Add(fileAttachment);

相关文章:

  • 2022-03-10
  • 2021-08-31
  • 2021-12-18
  • 2021-10-24
  • 2021-12-17
  • 2022-02-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-06-14
  • 2021-11-13
  • 2021-09-12
相关资源
相似解决方案