zoukankan      html  css  js  c++  java
  • 邮件附件的相关信息

    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);
  • 相关阅读:
    绘制八卦阵
    绘制奥运五环
    绘制渐变的圆
    实验报告
    大学排名
    第一条爬虫
    自己的第一个网页
    科学计算与可视化
    类和正则表达(自动更正 代数运算)
    预测比赛
  • 原文地址:https://www.cnblogs.com/ruanbl/p/816935.html
Copyright © 2011-2022 走看看