How do I send notification emails to localhost

I want to send notification emails to a local email server. The following test failed:

barsch@machine ~ $ kopia notification profile configure email \
    --profile-name=email \
    --smtp-server=127.0.0.1 \
    --smtp-port=25 \
    --mail-from=noreply@xxx.yy \
    --mail-to=admin@xxx.yy \
    --format=txt \
    --send-test-notification
Sending test notification to SMTP server: "127.0.0.1", Mail from: "noreply@xxx.yy" Mail to: "admin@xxx.yy" Format: "txt"
ERROR unable to send test notification: unable to send notification message: tls: failed to verify certificate: x509: cannot validate certificate for 127.0.0.1 because it doesn't contain any IP SANs

Sending emails per shell is working, e.g.

barsch@machine ~ $ echo "This is a test." | mail -s "Test" barsch@xxx.yy

Any ideas?

This is not really kopia issues but your SMTP certificate problem. Looks like kopia does it right and requires server to be configured properly.

To validate the certificate successfully the IP must be given inside the subject alternative names section.

When you create your certs:

  1. Edit your /etc/ssl/openssl.cnf - add subjectAltName = IP:127.0.0.1 in [v3_ca] section.
  2. Recreate the certificate

You will also find tones of sources on google how to create proper certs.

no - port 25 above means I want to connect via plain unencrypted SMTP service (configured as send only to smarthost) which does not require a certificate - one can test this with a simple telnet client, e.g.:

barsch@machine ~ $ telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 machine ESMTP Exim 4.96 Sat, 14 Dec 2024 00:30:00 +0000
EHLO xxx.yy
250-machine Hello localhost [127.0.0.1]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-PIPECONNECT
250-CHUNKING
250-STARTTLS
250-PRDR
250 HELP
MAIL FROM:noreply@xxx.yy
250 OK
RCPT TO:admin@xxx.yy
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
Subject: Test

This is a test.

.
250 OK id=1tMG3n-0020gr-2R
QUIT
221 machine closing connection
Connection closed by foreign host.
barsch@machine ~ $

So it seems Kopia does not to support unencrypted SMTP, or?

Unfortunately I am also realizing that Kopia notification email authentication is limited and only supports SSL, and has no other options.
In my case I got this error when sending to port 587 (which requires SMTP authentication username and password)

ERROR unable to send notification message: tls: failed to verify certificate: x509: certificate signed by unknown authority

Just when I discover that Kopia now has email notifications I get disappointed that I cant use it since we have an internal LAN mail server that use SSL for internal communications :frowning: