EDIT: Solved, check Brkdncr@lemmy.world’s comment below.
So, I am currently in the process of setting up a PeerTube and Lemmy instance, both on a dedicated Server running Debian 12. PeerTube seems to work properly by now, but the SMTP settings for Lemmy have been a bit of a headscratcher, and I wasn’t able to find a solution.
To set up Lemmy, I followed the “from scratch” guide, and, besides the mail issue, it seems like everything else is working so far.
Note that I am currently in the process of learning-by-doing with this whole project. So, I would not rule out, that I may have overlooked something really obvious and stupid, sorry for taking your time, then.
My settings in /opt/lemmy/lemmy-server/lemmy.hjson:
email: {
# Hostname and port of the smtp server
smtp_server: "localhost:587"
# Login name for smtp server
smtp_login: "lemmymail"
# Password to login to the smtp server
smtp_password: "REDACTED"
# Address to send emails from, eg "noreply@your-instance.com"
smtp_from_address: "noreply@abnormalbeings.space"
# Whether or not smtp connections should use tls. Can be none, tls, or starttls
tls_type: "starttls"
}
The error message I get, when trying both resetting a password, or applying as a new user:
WARN Error encountered while processing the incoming HTTP request: lemmy_server::root_span_builder: EmailSendFailed: Connection error: Connection error: invalid peer certificate: NotValidForName
“lemmymail” exists as a local user on the server.
# dovecot --version 2.3.19.1 (9b53102964)
If needed, I can provide additional info from dovecot and/or postfix configurations in the backend. Similar settings as above have worked for PeerTube. As a reference - these are working in production.yaml there:
Peertube smtp settings
# SMTP server to send emails
smtp:
# smtp or sendmail
transport: smtp
# Path to sendmail command. Required if you use sendmail transport
sendmail: null
hostname: mail.abnormalbeings.space
port: 587 # If you use StartTLS: 587
username: 'peertube@abnormalbeings.space'
password: 'REDACTED'
tls: false # If you use StartTLS: false
disable_starttls: false
ca_file: null # Used for self signed certificates
from_address: 'peertube@abnormalbeings.space'
Things I have tried:
- Changing the user from and to a user with @abnormalbeings.space in the string
- Changing the user to one I know works, as I use them for automatic PeerTube mail messages
- Changing the hostname to a FQDN url instead of localhost (without https://)
- Trying different ports (did not expect that to work)
- changing tls_type to “none”
- changing the Password to one containing no special characters (and back)
- changing smtp_from_address to an actually existing user
- restarting nginx, dovecot, postfix, lemmy-server and lemmy-ui for good measure after every change
Thank you! Seems to be working now!
I was pretty sure I had already tried that, but I probably had something else not configured correctly when I did, so I probably hadn’t tried it yet with the proper combination of values in addition to that! (I am glad I haven’t managed to break it somewhere else while trying stuff)