Send an Email from GitHub Actions.
- A Twilio SendGrid Account. Sign up for free
- A SendGrid API Key The documentation can be viewed here. (https://sendgrid.com/docs/ui/account-and-settings/api-keys/)
-
Create an API Key to access the API.
-
Store the key in
SENDGRID_API_KEY -
Create an Unsubscribe Group for the email receipents to unsubscribe from. This can be done here (https://app.sendgrid.com/suppressions/group_unsubscribes) and documentation here (https://sendgrid.com/docs/ui/sending-email/group-unsubscribes/#gatsby-focus-wrapper)
-
(Optional) Create an Email Template here: https://mc.sendgrid.com/dynamic-templates
-
Add the following to your workflow
- name: 'Sending Email with SendGrid'
uses: mmeisels/action-send-an-email-@v1
with:
emailToAddress: 'test@mike.com'
emailFromAddress: 'from@mike.com'
emailBody: 'email body text - can be html also'
unSubscribeGroupID: 'unsusbcribe group ID from step 3'
emailTemplateID: 'Email Template ID from Step 4'
env:
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}Required This is the Email Address you wish to send an email to
Required This is the Email Address you wish to send an email from
Required The SendGrid API Key
If you are not using an email template, you need to pass the email body either as text or html in the message
The SendGrid Unsubscribe Group
The SendGrid Email Template ID from Step 4
The Response of the Email Interaction. Emails are Async - you can review the actual email response in the SendGrid Analytics or setup a webhook.
This GitHub Action uses a couple of Node.js modules to work.
License and other copyright information for each module are included in the release branch of each action version under node_modules/{module}.
More information for each package can be found at https://www.npmjs.com/package/{package}