Learning Notes #2 β Automate Email Notifications in GitHub Actions
20 December 2024 at 07:07
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 ?
- Gmail SMTP Server address β smtp.gmail.com
- Gmail SMTP port β 465
- Email username β your mail id.
- 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