Azure Serverless Computing Cookbook
上QQ阅读APP看书,第一时间看更新

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: