Skip to content

Send Email With SendGrid

Actions
Using python library, send an email to SendGrid API
v1.1.0
Latest
Star (15)

Send Email Notification

pre-commit License

Using the Sendgrid Python library, send email to people with the content & subject of your choice.

This repository is used inside Github Actions in the following format:

Send email to one address

      - uses: licenseware/send-email-notification@v1
        with:
          api-key: ${{ secrets.SENDGRID_API_KEY }}
          subject: Test Subject
          from-email: [email protected]
          to-email: [email protected]
          markdown-body: |
            # My Markdown Title

            This is a description

            ## Another header

            Another description

Send email to multiple addresses upon Github release

on:
  release:
    types:
      - published

jobs:
  release-notification:
    name: release notification
    runs-on: ubuntu-latest
    strategy:
      matrix:
        to-emails:
          - [email protected]
          - [email protected]
          - [email protected]

    steps:
      - uses: licenseware/send-email-notification@v1
        with:
          api-key: ${{ secrets.SENDGRID_API_KEY }}
          subject: New Release ${{ github.repository }}:${{ github.ref_name }}
          from-email: [email protected]
          to-email: ${{ matrix.to-emails }}
          markdown-body: ${{ github.event.release.body }}

Send email with attachments

      - uses: licenseware/send-email-notification@v1
        with:
          api-key: ${{ secrets.SENDGRID_API_KEY }}
          subject: Test Subject
          from-email: [email protected]
          to-email: [email protected]
          markdown-body: |
            Hey, check out this file
          attachments: |
            ./path/to/file1.txt
            ./path/to/file2.txt
          # optionally, a list of zero, one, or the same size {inline, attachment}
          attachments-disposition: |
            attachment
            attachment

Run Docker Container Locally

Grab the latest tag from here:

GitHub Tag

export SENDGRID_API_KEY="CHANGE_THIS"

docker run --rm \
  --name send-email-notification \
  ghcr.io/licenseware/send-email-notification \
  --api-key=${SENDGRID_API_KEY} \
  [email protected] \
  [email protected] \
  --subject="Send email notifications" \
  --markdown-body="""
# Send email notifications

Checkout this cool repository:

<https://github.com/licenseware/send-email-notification>
"""

Send Email With SendGrid is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Using python library, send an email to SendGrid API
v1.1.0
Latest

Send Email With SendGrid is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.