Skip to content

Added support for LOGIN AUTH for the SMTP sender#1530

Open
santanoce wants to merge 2 commits intobinwiederhier:mainfrom
santanoce:feat/login_auth
Open

Added support for LOGIN AUTH for the SMTP sender#1530
santanoce wants to merge 2 commits intobinwiederhier:mainfrom
santanoce:feat/login_auth

Conversation

@santanoce
Copy link

@santanoce santanoce commented Jan 1, 2026

This should fix #1020, even though it seems that Microsoft 365 Outlook is no longer allowing base authentication for personal accounts, so I wasn't able to actually test it with a Microsoft account. I did however test it using a simple SMTP server supporting LOGIN AUTH and it works.

I basically followed the suggestion in #930, more specifically using the code from here, which in turn is an adaptation of code in the net/smtp package.

@binwiederhier
Copy link
Owner

I am quite interested in merging this, but I don't know how to test it.

@santanoce
Copy link
Author

santanoce commented Jan 22, 2026

I am quite interested in merging this, but I don't know how to test it.

@binwiederhier, you may use Docker Mailserver. For example:

services:
  mailserver:
    image: mailserver/docker-mailserver:latest
    hostname: mail.example.com
    container_name: mailserver
    ports:
      - "587:587"
    volumes:
      - ./dovecot.cf:/tmp/docker-mailserver/dovecot.cf
    environment:
      - ENABLE_SPAMASSASSIN=0
      - ENABLE_CLAMAV=0
      - ENABLE_FAIL2BAN=0
      - [email protected]
    cap_add:
      - NET_ADMIN
    restart: always

and inside dovecot.cf you can force only the LOGIN AUTH mechanism:

auth_mechanisms = login
disable_plaintext_auth = no

The application needs an account to start with, that you can create with the following command:

docker exec -ti mailserver setup email add [email protected] mypassword

Now you can check the available authentication mechanism via nc, for example:

nc localhost 587
EHLO localhost

At this point ntfy can be configured with:

smtp-sender-addr: "localhost:587"
smtp-sender-user: "[email protected]"
smtp-sender-pass: "mypassword"

Now you should be able to check that the LOGIN authentication method is actually working. Indeed, if you try to send a message without my commits you will receive an Invalid authentication mechanism error from ntfy logs, while everything will work fine if you try with the commits from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email authentication fails with Microsoft 365 Outlook SMTP

2 participants