
上QQ阅读APP看书,第一时间看更新
Adding an attachment to the email
Perform the following steps:
- Add the following code to the Run method of the SendNotifications function, and save the changes by clicking on the Save button:
message.AddAttachment(FirstName +"_"+LastName+".log",
System.Convert.ToBase64String
(System.Text.Encoding.UTF8.GetBytes
(emailContent)),
"text/plain",
"attachment",
"Logs"
);
- Run a test using the same request payload that we have used in the previous recipes.
- This is the screenshot of the email, along with the attachment:

You can learn more about the Send Grid API at https://sendgrid.com/docs/API_Reference/api_v3.html.