Configure Email

EMAIL SETTINGS

Its essential to configure email settings before spotipo can send out emails including reports and other messages. During the development we have taken up the decision of not increasing code complexity by supporting different email servers. So out of the box Spotipo will support only email servers without authentication.

You can configure this by going to Dashboard -> Manage -> General Settings 

And restart spotipo service using

sudo service supervisor restart

If everything is fine, you should be able to send a Test email 

However it may not be ideal for everyone, for those who would like to use a mail server that needs authentication, we recommend postfix ( works only in Linux unfortunately)

Install postfix in Ubuntu/Debian
sudo apt-get install libsasl2-modules
sudo apt-get install postfix

During installation, select the configuration type as Internet Site

And provide the FQDN of your server

Once installation is finished open the configuration file and change the listening interface. Very important to avoid SPAM messages. Inet interfaces must be set to localhost

vim /etc/postfix/main.cf
Enable Authenticated Relay

Create a file called  /etc/postfix/sasl_passwd and Enter your SMTP host and credentials in it as below.

mail.isp.example.com username:password

Create a password hash by running 

sudo postmap /etc/postfix/sasl_passwd

Edit the postfix configuration  and modify the following line with your relay server address

# specify SMTP relay host 
relayhost = mail.isp.example:587

Now add the following lines to postfix config file to enable authentication

# enable SASL authentication 
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Now you can restart the postfix and everything should be in place

sudo service postfix restart
How to test postfix 

Fastest way to test postfix configuration is by trying to send an email using mail utility.

Replace the From and Recipient address with actual values 

echo "body of your email" | mail -s "This is a Subject" -a "From: [email protected]" [email protected]

How did we do?