Post

Learning Notes #2 - Automate Email Notifications in GitHub Actions

Learning Notes #2 - Automate Email Notifications in GitHub Actions

{% raw %}

Today, i was checking youtube videos on github actions. I came across a video on sending a mail via a Github Action https://www.youtube.com/watch?v=SkD7KQ3KzZs&t=108s. This blog is just an implementation of the video.

What am i going to do ?

I need to send a mail using my gmail id via Github

What prior information you need ?

  1. Gmail SMTP Server address – smtp.gmail.com
  2. Gmail SMTP port – 465
  3. Email username – your mail id.
  4. Email password – App Password from Google. https://support.google.com/accounts/answer/185833?hl=en.

YAML File

name: "Send Mail"on:  workflow_dispatch:jobs:  mail:    runs-on: ubuntu-latest    steps:      - name: Print Name        run: echo "Sending Mail"          - name: Send Mail        if: ${{ always() }}        uses: dawidd6/action-send-mail@v3        with:          server_address: smtp.gmail.com          server_port: 465          username: ${{ secrets.EMAIL_USERNAME }}          password: ${{ secrets.EMAIL_PASSWORD }}          subject: ${{ github.job }} job of ${{ github.repository }} has  ${{ github.status }}          body: "Test Message in Github"          to:  syedjafer1997@gmail.com          from: Syed Jafer K

My Github Run: https://github.com/syedjaferk/gh_actions_templates/actions/runs/12426929593

{% endraw %}

This post is licensed under CC BY 4.0 by the author.