dawidd6/action-send-mail

Invalid login: 535 5.7.8 Error: authentication failed: authentication failed

Rapter1990 opened this issue · 1 comments

I try to send test report of my node.js project with github action automatically.

Here is the relevant part of github action

- name: Send test report email
        uses: dawidd6/action-send-mail@v3
        with:
          server_address: smtp.protonmail.ch
          server_port: 587
          username: ${{ secrets.EMAIL_USERNAME }}
          password: ${{ secrets.EMAIL_PASSWORD }}
          subject: Test Report
          body: Test results attached.
          to: <mail_address>
          from: ${{ secrets.EMAIL_USERNAME }}
          attachments: report.png

I always get the error shown below

Invalid login: 535 5.7.8 Error: authentication failed: authentication failed

EMAIL_USERNAME refers to my email of proton.me
EMAIL_PASSWORD refers to my email's password of proton.me

I also tried to use username of proton.me account but nothing changed. I still got the same error.

Where is the problem? How can I fix it?

I got this same error. However, I did two things at once, and I can't tell which fixed it.

  1. I have my password as a Github secret (obviously), I went back and re-entered it again just in case it was a typo. No quotations in the secret, check for spaces.
  2. My SPF record was invalid. SPF has a limit of 10 domains. I went to a couple of websites to validate my SPF:

The 2nd URL gives more detail.

After I updated my SPF record in Cloudflare and re-tried the action, it worked, and sent the email right through. I've spent a lot of time making sure I have every damn required record, SPF, DMARC, etc.

The invalid authentication error doesn't make a lot of sense to be thrown by SPF, but it's worth a shot.

And also just double-confirm you really did enter the right password.

        - name: Send mail
          uses: dawidd6/action-send-mail@v3
          with:
                server_address: ${{secrets.EMAIL_SMTP}}
                server_port: 465
                secure: true
                username: ${{secrets.EMAIL_FROM}}
                password: ${{secrets.EMAIL_KEY}}
                subject: Test Email
                to: ${{secrets.EMAIL_TO}}
                from: ${{secrets.EMAIL_FROM}}
                body: Build job of ${{github.repository}} completed successfully!
                html_body: |
                  <html>
                    <body>
                        this is a text email
                    </body>
                  </html>
                ignore_cert: false
                convert_markdown: true
                priority: normal

For me, port 25 isn't an option. DMARC blocks the email, and if I set the rules too low, I start failing tests.