dawidd6 / action-send-mail

:gear: A GitHub Action to send an email to multiple recipients
MIT License
455 stars 188 forks source link

How to use SES to send emails for job failure #122

Closed Muneeshbiologit closed 2 years ago

Muneeshbiologit commented 2 years ago

I am using the below code snippet for sending emails for action status using AWS SES. But i am keep facing issue fro from address

 if: always()
      uses: dawidd6/action-send-mail@v3
      with:
        # mail server settings
        server_address: ${{secrets.SMTP_HOST}}
        server_port: 465
        # Optional (recommended): mail server username:
        username: ${{secrets.SMTP_USERNAME}}
        # Optional (recommended) mail server password:
        password: ${{secrets.SMTP_PASSWORD}}
        # email subject
        subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
        # email body as text
        body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
        # comma-separated string, send email to
        to: test@example.com
        # from email name
        from: test@example.com
dawidd6 commented 2 years ago

So what is the issue?

Muneeshbiologit commented 2 years ago

@dawidd6 i am getting the error lik below

image

FYI i opened ticket in stackoverflow as well..it would be great help if you could help me to sort it out..

the from and to and domain all three are already verifed in AWS SES. also we are not in sandbox

https://stackoverflow.com/questions/73081286/get-email-notification-from-github-actions-failure-using-aws-ses

Thankyou Muneesh

dawidd6 commented 2 years ago

Try:

from: Name Surname <user@domain.com>
Muneeshbiologit commented 2 years ago

@dawidd6 i used the above format but still getting same error. Any idea on this? image

I gave like this but still failing...any idea...as i told before we are using AWS SES with SMTP credentials.

Muneeshbiologit commented 2 years ago

@dawidd6 thankyou very much for your time..i made it work

dawidd6 commented 2 years ago

Maybe post the solution here that worked for you, so anyone else won't need to ask same question again.

joynerar commented 2 years ago

@dawidd6 I had the same issue when trying to send email from AWS SES. It seems the from field in the action needs to be explicitly set to the format:

from: username <user@domain.com>

I think that AWS is angry about the double quotes encapsulating the name.

dawidd6 commented 2 years ago

Thanks for the solution, closing.