官术网_书友最值得收藏!

Adding an attachment to the email

  1. Add the following code to the Run method of the RegisterUser function:
        Attachment objAttachment = new Attachment();
objAttachment.Content = System.Convert.ToBase64String
(System.Text.Encoding.UTF8.GetBytes(emailContent));
objAttachment.Filename = firstname + "_" + lastname + ".log";
message.AddAttachment(objAttachment);
  1. Let's run a test using the same request payload that we have used in the previous recipes.
  2. This is the screenshot of the email, along with the attachment:
主站蜘蛛池模板: 鹤山市| 阿克陶县| 本溪| 元朗区| 城口县| 赣州市| 红原县| 修水县| 体育| 白水县| 黄龙县| 读书| 科尔| 马尔康县| 泰和县| 崇义县| 牙克石市| 饶阳县| 宁武县| 旬阳县| 乌什县| 观塘区| 巫溪县| 连云港市| 革吉县| 金坛市| 茶陵县| 达拉特旗| 永平县| 屏南县| 荥阳市| 洛宁县| 江阴市| 礼泉县| 宜州市| 佛山市| 阳城县| 五寨县| 德令哈市| 于田县| 洪湖市|