![Azure Serverless Computing Cookbook](https://wfqqreader-1252317822.image.myqcloud.com/cover/144/36699144/b_36699144.jpg)
上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:
![](https://epubservercos.yuewen.com/A7AC35/19470384701521706/epubprivate/OEBPS/Images/fb501dea-b13d-4151-89d5-6952ce834880.png?sign=1738943626-TXkSDbkQiDoGu5zLV1qtNwoiyoeah6oo-0-80b9bf8fe57056e0ad9a0b85a4f90dbc)
You can learn more about the Send Grid API at https://sendgrid.com/docs/API_Reference/api_v3.html.