-
Notifications
You must be signed in to change notification settings - Fork 5
Email configuration
This is optional. You can skip this and the script will use it's default values (email integration being disabled).
You can run this function with root privileges so the script can add the postfix configuration to /etc/postfix/main.cf and /etc/postfix/sasl_passwd or it can be executed with the isrsrv user to only change the configuration values in the script's email configuration file but you will have to add the configuration to /etc/postfix/main.cf and /etc/postfix/sasl_passwd manually.
To use the email function for instance with a gmail account you have to enable two factor authentication on gmail and then create an application password for it.
Run the script with root privliges and follow the instructions:
sudo sesrv-script config_email
These is an example configuration for gmail. Add these lines to the following file:
/etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CApath = /etc/ssl/certs
smtpd_tls_CApath = /etc/ssl/certs
smtp_use_tls = yes
Then add your email address and application password to the following file (without brackets):
/etc/postfix/sasl_passwd
[smtp.gmail.com]:587 <your.email@gmail.com>:<application-password>
Change file permissions, use postmap to setup the account and enable the postfix service:
sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo systemctl enable postfix
Create the following file and add these lines to it based on your desired configuration (1 is true, 0 is false):
/srv/sesrv/config/sesrv-email.conf
email_sender=the-account-that-will-send-emails@gmail.com
email_recipient=the-account-that-will-recieve-emails@gmail.com
email_update=1
email_start=1
email_stop=1
email_crash=1
email_tmpfs_space=1