In this article let us discuss Sending email with attachment using Powershell and Send Grid. This includes the below steps (Also Available Github)
Advantages:
Pre-Requisite: You need to have SendGrid Account (If you don’t have one create a Free Account)
Step 1: Register Sender in Send Grid
Step 2: Generate Send Grid API Key
Step 3: Create a Powershell function to send an email with attachment using SendGrid API
Step 4: Call the function using Powershell
Login to SendGrid account with your username and password
(_Note: If you do not have a SendGrid account create one using SendGrid _SignUp)
Navigate to Settings > Sender Authentication
Click on Verify Single Sender
In a Create Sender Form, Enter all the mandatory details and Click on Create
API Key is very important and mandatory if you are using SendGrid API to Send Emails
In order to Generate API Key, Go to Settings > Click on API Keys
Now, Click on Create API Key
Enter Your API Key Name, Choose Access and Click on Create and View
Once everything is done, You will see API Key
Important!: Copy the API Key and save Somewhere, If you lose this API key you can’t get it back.
Now we have successfully added the sender and generated the API key.
Next, We need to create a Powershell script to Call the API and Send an Email.
#api #jenkins #powershell #azure devops #powershell script #devops