How to do it...

Perform the following steps:

  1. Navigate to the Integrate tab of the SendNotifications function, click on New Output, and choose Azure Blob Storage. It would prompt you to install the Storage Extensions; please install the extensions to continue forward.
  2. Provide the required parameters in the Azure Blob Storage output section, as shown in the following screenshot. Note the .log extension in the Path field:
  1. Navigate to the code editor of the run.csx file of the SendNotifications function and make the following changes:

    1. Add a new parameter, outputBlob, of the TextWriter type to the Run method.
    2. Add a new string variable named emailContent. This variable is used to frame the content of the email. We will also use the same variable to create the log file content that is finally stored in the blob.
    3. Frame the email content by appending the required static text and the input parameters received in Request body, as follows:
public static void Run(string myQueueItem,
out SendGridMessage message,
TextWriter outputBlob,
ILogger log)
....
....
string FirstName=null, LastName=null, Email = null;
string emailContent;
....
....
emailContent = "Thank you <b>" + FirstName + " " +
LastName +"</b> for your registration.<br><br>" +
"Below are the details that you have provided
 us<br> <br>"+ "<b>First name:</b> " +
FirstName + "<br>" + "<b>Last name:</b> " +
LastName + "<br>" + "<b>Email Address:</b> " +
inputJson.Email + "<br><br> <br>" + "Best Regards," + "<br>" + "Website Team";
message.AddContent(new
Content("text/html",emailContent));
outputBlob.WriteLine(emailContent);
  1. Run a test using the same request payload that we used in the previous recipe.
  1. After running the test, the log file will be created in the container named userregistrationemaillogs: