Emailer setup in Peertube

Hi everyone,
I am trying to set up e-mailer in Peertube so my instance can send e-mail notifications to new users that they have been accepted ( or not) .
This is my configuration in in /var/www/peertube/config/production.yaml

SMTP server to send emails

smtp:

smtp or sendmail

transport: smtp

Path to sendmail command. Required if you use sendmail transport

sendmail: null
hostname: ‹ smtp.myhost.com ›
port: 465
username: ‹ info@myemail.tv ›
password: ‹ mypassword ›
tls: true # If you use StartTLS: false
disable_starttls: false
ca_file: null # Used for self signed certificates
from_address: ‹ info@myemail.tv ›

It crashes peerrtube upon restart
What am I missing here?
Thanks.

Is there an error message log when it crashed?
It migth be an invalid configuration file. For example if your password contains double quotes, bad value escaping, or bad indentation. The error log should help you to find the typo.

This was the error when trying to restart peertube
peertube.service: Failed with result ‹ exit-code ›.Failed to start PeerTube daemon

I have deleted the smtp configuration from /var/www/peertube/config/production.yaml
and peertube is working again.
My question is , how to set up the stmp server to send mails.
Thanks.

Hi, this is my config:

# SMTP server to send emails
smtp:
  # smtp or sendmail
  transport: smtp
  # Path to sendmail command. Required if you use sendmail transport
  sendmail: null
  hostname: smtp.example.org
  port: 587 # If you use StartTLS: 587
  username: user@example.org
  password: **************
  tls: false # If you use StartTLS: false
  disable_starttls: false
  ca_file: null # Used for self signed certificates
  from_address: 'user@example.org'

Thanks Thomas.
The port 587 shouldn’t it be the host outgoing port?

Yes this is a good question. How does one setup the email server?

Would you just follow the guide for a regular Dovecot/IMAP system that has nothing to do with peertube? Then link it via the peertube yaml file config?

No, it’s not. You can use 587 with starttls or 465 with ssl/tls.

There must be a more specific message error.
You can check with journalctl -feu peertube for example. Or maybe in your syslog log file.

It really looks a lot like an invalid configuration file, like I said in my first comment. But I can’t tell with your configuration file copy/pasted, because it is not well formated. You can paste formatted files using three backquotes (`) on new lines before and after the data.

There are multiple way to do. The simpliest is to use a mailbox hosted by your host name registrar (they often offer free mailboxes).

Or you can simply setup Exim4 or Postfix on the server. Or install sendmail. But in these cases, you have some extra things to check, to be sure that your mails will not be marked as spam (have you SPF records on your domain? etc…)
This is a complex topic, and you can find multiple guide or tutorial on the web.

Would installing PostFix and Mailutils for outgoing emails, but NOT having Dovecot for incoming email, save on VPS CPU/RAM for faster peertube?

Mail softwares (postfix, dovecot, …) are relatively light, and won’t slow down your Peertube.
But, indeed, you don’t have to install Dovecot.
You can install only the software required for outgoing mails. You can even send mail from the same address from multiple servers. And receive (or not) mail on another one. Mail protocols are very flexible.

In your case, you only need what is called a Mail Transfer Agent (Postfix, Exim4, or Sendmail).

1 « J'aime »

Cool, I got Postfix installed with DMARC and SPF entries in my DNS. Where is the documentation on how to modify the production.yaml file to get this sending emails?
I want OPTIONAL email notifications for subscribers, but not a requirement to do so

I am running my Peertube instance on an Ubuntu server so my option is
sudo nano /var/www/peertube/config/production.yaml

There is a production.yaml.example from line 76. Maybe @JohnLivingston can confirm if this is a functioning release of production.yaml

This config file has nothing changed for the email servers… aren’t you supposed to modify this?

SMTP server to send emails

smtp:
# smtp or sendmail
transport: smtp
# Path to sendmail command. Required if you use sendmail transport
sendmail: null
hostname: null
port: 465 # If you use StartTLS: 587
username: null
password: null
tls: true # If you use StartTLS: false
disable_starttls: false
ca_file: null # Used for self signed certificates
from_address: 'admin@example.com'

See the answer from Thomas above

I don’t understand your question.

Check your serveur log to find the error. It will tell you where is the error in your config file.