Open skirmess opened 5 months ago
What mail server do you use? I may try to set up an instance on my end and test it out (if setup is somewhat simple)
Good old postfix.
I run Jellyfin with docker. On the same host I've run a second container with Alpine for testing and configured postfix like so. You can keep the example.net stuff as we don't really want to send a mail while debugging anyway. 172.17.0.1 is the docker IP of the docker host.
$ docker run --rm -it -p 25:25 --hostname mailhost.example.net alpine sh
# apk add postfix
# echo '172.17.0.1 jellyfin.example.net' >> /etc/hosts
# echo 'myhostname = mailhost.example.net' >> /etc/postfix/main.cf
# echo 'mydomain = example.net' >> /etc/postfix/main.cf
# echo 'mynetworks = $myhostname, 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12' >> /etc/postfix/main.cf
# echo 'maillog_file = /var/log/postfix.log' >> /etc/postfix/main.cf
# postfix start
Then view the log with
# tail -f /var/log/postfix.log
Let's try it from the docker host (outside of any container).
$ nc localhost 25
220 mailhost.example.net ESMTP Postfix
EHLO jellyfin.example.net
250-mailhost.example.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING
MAIL FROM: test@example.net
250 2.1.0 Ok
RCPT TO: <root@example.net>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: test
test
.
250 2.0.0 Ok: queued as F3DAC281BA
quit
221 2.0.0 Bye
Which produces this log:
May 15 20:55:08 mailhost postfix/smtpd[93]: connect from jellyfin.example.net[172.17.0.1]
May 15 20:55:16 mailhost postfix/smtpd[93]: F3DAC281BA: client=jellyfin.example.net[172.17.0.1]
May 15 20:55:23 mailhost postfix/cleanup[96]: F3DAC281BA: message-id=<>
May 15 20:55:23 mailhost postfix/qmgr[90]: F3DAC281BA: from=<test@example.net>, size=221, nrcpt=1 (queue active)
May 15 20:55:23 mailhost postfix/smtp[97]: F3DAC281BA: to=<root@example.net>, relay=none, delay=8, delays=8/0.01/0.01/0, dsn=5.1.0, status=bounced (Domain example.net does not accept mail (nullMX))
May 15 20:55:23 mailhost postfix/cleanup[96]: 94514281BF: message-id=<20240515205523.94514281BF@mailhost.example.net>
May 15 20:55:23 mailhost postfix/qmgr[90]: 94514281BF: from=<>, size=2163, nrcpt=1 (queue active)
May 15 20:55:23 mailhost postfix/bounce[98]: F3DAC281BA: sender non-delivery notification: 94514281BF
May 15 20:55:23 mailhost postfix/qmgr[90]: F3DAC281BA: removed
May 15 20:55:24 mailhost postfix/smtp[97]: 94514281BF: to=<test@example.net>, relay=none, delay=0.24, delays=0.22/0/0.01/0, dsn=5.1.0, status=bounced (Domain example.net does not accept mail (nullMX))
May 15 20:55:24 mailhost postfix/qmgr[90]: 94514281BF: removed
May 15 20:55:27 mailhost postfix/smtpd[93]: disconnect from jellyfin.example.net[172.17.0.1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 unknown=0/1 commands=5/6
As you can see, the mail gets accepted (and is then discarded as example.net doesn't accept mails)
Trying it from Jellyfin:
This produces this log
May 15 21:03:24 mailhost postfix/smtpd[101]: connect from jellyfin.example.net[172.17.0.1]
May 15 21:03:24 mailhost postfix/smtpd[101]: lost connection after EHLO from jellyfin.example.net[172.17.0.1]
May 15 21:03:24 mailhost postfix/smtpd[101]: disconnect from jellyfin.example.net[172.17.0.1] ehlo=1 commands=1
Thanks for the info! Would you mind sharing some debug Newsletter logs as well?
I never tried to get the plugin working because of this issue. How would I do that? Just add something and wait 12 hours? Or is there a way to trigger that to debug it?
You can manually trigger the scheduled tasks in Dashboard > Scheduled Tasks. There's a "newsletter" section. Run "scraper" then "email"
Same error
May 17 18:50:48 mailhost postfix/smtpd[96]: connect from jellyfin.example.net[172.17.0.1]
May 17 18:50:48 mailhost postfix/smtpd[96]: lost connection after EHLO from jellyfin.example.net[172.17.0.1]
May 17 18:50:48 mailhost postfix/smtpd[96]: disconnect from jellyfin.example.net[172.17.0.1] ehlo=1 commands=1
Can you share the newsletter logs? (jellyfin Dashboard > logs)
I guess that's what you're looking for. (full log)
[NLP]: [2024-05-17] :: [20:49:07] - [INFO] Closing Database: /config/data/newsletters.db
[NLP]: [2024-05-17] :: [20:49:07] - [ERR] An error has occured: System.Net.Mail.SmtpException: Server does not support secure connections.
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Jellyfin.Plugin.Newsletters.Emails.EMAIL.Smtp.SendEmail()
[NLP]: [2024-05-17] :: [20:49:07] - [INFO] Database lock file does not exist. Database is not use: /config/data/newsletters.db.lock
Yep! this is it! I'll use this info when working on the plugin to try and resolve/add this feature in! (since I believe it's designed currently to require username/password)
I don't use this plugin, but it came up as I was looking for email solutions for my jellyfin server. But I have a comment that might be interesting none the less. :-)
I run jellyfin at home on actual hardware, no virtualization or containering like Docker. I also run my actual official mailserver at home. Meaning that I don't have an email account with my ISP, Gmail, Hotmail, Yahoo or what they are all called.
So, internal systems can send email to the world using my internal Postfix mail system without any authentication. So if I was using this plugin, it would send email using no usernane, no password and no encryption inside my local network.
Many Linux users do this. They have an internal mail server on every system running linux, which feeds mail going to the outside world to another internal mailser which then sends it out using encryption and so on.
So this plugin should account for the fact that some users might want to use the mail server at Localhost / 127.0.0.1. It should not assume that all users of this plugin configure an outside server for facilitating email delivery.
I have a local mail relay in my home network which accepts mail on port 25 without authentication and forwards them to an outgoing SMTP server. Because of that I don't have to configure mail credentials on every system/in every app. Unfortunately, this plugin seems to not be able to send mails if the SMTP Username and SMTP Password field is left empty. When I press the Test button I see the following on my mail server.
Looks like the plugin just gives up after saying hello.