YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 34 forks source link

Need help configuring email to use my own SMTP server #282

Closed binarydad closed 2 years ago

binarydad commented 3 years ago

I'm running the latest 3.4.1, on YNH 4.2.5.3, and am trying to get Mastodon to use my internal SMTP server. My server is configured to handle STARTTLS on 25. The server is tried and true, and does work, but my issue is I cannot easily test the sending of email. My only means of diagnosing is enabling email notifications on mastodon and digging through logs. I don't see any errors, and searching through journalctl is like finding a needle in a haystack.

I also don't know enough about YNH's native SMTP handling, which I'm not using, as I have my own mail server.

Basically, if I were to use my own SMTP server, what options below do I need to enable/configure? And is there some means of testing email, specifically for mastodon? Thank you.


# ------------
SMTP_SERVER=email.tld
SMTP_PORT=25
#SMTP_LOGIN=
#SMTP_PASSWORD=
SMTP_FROM_ADDRESS=mastodon@email.tld
#SMTP_REPLY_TO=
#SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
#SMTP_DELIVERY_METHOD=smtp # delivery method can also be smtp
#SMTP_AUTH_METHOD=none
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
#SMTP_OPENSSL_VERIFY_MODE=none
SMTP_ENABLE_STARTTLS_AUTO=true
#SMTP_TLS=true```
yalh76 commented 3 years ago

Maybe you should not change mastodon configuration but go through https://yunohost.org/en/email_configure_relay

Tagadda commented 3 years ago

@binarydad You can try sending mails from the Rails console, if it fails you'll see the error. (see https://github.com/tootsuite/documentation/blob/archive/Running-Mastodon/Production-guide.md#email-service)

This command should do the trick to launch rails console in Yunohost, I guess? not tested.

$ (cd /var/www/mastodon/live && sudo -u mastodon RAILS_ENV=production PATH=/opt/rbenv/versions/mastodon/bin bundle exec rails c)
binarydad commented 3 years ago

Ok, thank you both! I ran the script to test emailing via the rails command and it was successful. I assume this means the YNH SMTP relay is correct?

Still, I don't seem to get emails through mastodon. I have email notifications enabled, but I receive none. My issue is, I've messed with my .env.production enough to try and fix it, where I do not have the original values. In order for mastodon to use YNH's SMTP relay, should I leave the settings as follows (found here: https://github.com/YunoHost-Apps/mastodon_ynh/blob/master/conf/.env.production.sample)?

# ------------
SMTP_SERVER=localhost
SMTP_PORT=25
#SMTP_LOGIN=
#SMTP_PASSWORD=
SMTP_FROM_ADDRESS=__ADMIN_MAIL__
#SMTP_REPLY_TO=
#SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
SMTP_DELIVERY_METHOD=sendmail # delivery method can also be smtp
SMTP_AUTH_METHOD=none
#SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
SMTP_OPENSSL_VERIFY_MODE=none
#SMTP_ENABLE_STARTTLS_AUTO=true
#SMTP_TLS=true
binarydad commented 3 years ago

Actually, does the "digest" setting override the settings above it? Meaning, it will only send the "Someone XXX you" emails after long inactivity? If so, that may make sense why I'm not receiving them.

image

Tagadda commented 3 years ago

@binarydad When you ran the test in the rails console, did you receive the mail ? If so, you're configuration should be working and you should receive notifications. Digest don't stop standard notifications, you're supposed to receive them anyway.

yalh76 commented 2 years ago

Feel free to reopen this issue if needed