Email Configuration with Postfix to send email notices in koha

Step-1

Gmail Account setting

Step-2

Open the terminal and apply the below commands one by one

sudo su   (Hit and Enter password)

sudo apt-get update

Install Postfix Mail Server

sudo apt-get install postfix


Select no configuration with the help of the arrow key and then select Ok with the tab key


Copy the file

sudo cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf

Install Packages below

sudo apt-get install libsas12-2

sudo apt-get install libsas12-modules

sudo apt-get install ca-certificates

Open the following file with your favorite editor

sudo gedit /etc/postfix/main.cf

Copy and Paste the following lines at the bottom of the file:-

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_CAfile = /etc/postfix/cacert.pem

smtp_use_tls = yes

Open the following file 

sudo gedit /etc/postfix/sasl_passwd

Add your Gmail account ID and password in the file

[smtp.gmail.com]:587    gmailid@gmail.com:16 digit app password



Change the permission of the sasl_passwd file

sudo chmod 400 /etc/postfix/sasl_passwd

Translate the /etc/postfix/sasl_passwd to Postfix lookup tables

sudo postmap /etc/postfix/sasl_passwd

Create the /etc/aliases.db

sudo postalias hash:/etc/aliases

Create the /etc/postfix/cacert.pem.

Ubuntu 20.04 LTS user

sudo cat /etc/ssl/certs/Equifax_Secure_CA.pem >> /etc/postfix/cacert.pem

Ubuntu 18.04 LTS User

sudo cat /etc/ssl/certs/thawte_Primary_Root_CA.pem >> /etc/postfix/cacert.pem

Restart Postfix

sudo /etc/init.d/postfix restart

Enable email service

sudo koha-email-enable library

(Here library is the name of koha instance)

Now Do a few Setting in koha staff Interface

Check the setting in koha for all patron categories

Koha Administration→Patron categories→Overdue notice Required→Check yes


Allow mail Notifications

Koha Administration→Global System Preferences→Patrons→Enhancedmessagingpreferencess→ Allow

Define Default overdue action

Koha →Tools→ Overdue Notice/status triggers


If you have already configured the Postfix mail server to send the emails with the enabling less secure app Google account. Now you may not be able to send mail because Gmail has disabled a less secure app and this feature is being retired from 30th May 2022. You may follow the below steps only to enable sending the emails:-

Create  an App password (As above mentioned in step 1)

Open the following file 

sudo gedit /etc/postfix/sasl_passwd

Add your Gmail  ID and password to the file

[smtp.gmail.com]:587    gmailid@gmail.com:App Password(16 digits)

Apply following commands

sudo chmod 400 /etc/postfix/sasl_passwd

sudo /etc/init.d/postfix restart

Now your koha server is ready to send emails again.


Check also to configure email through the staff interface in Koha version 20.11 or later

Post a Comment

0 Comments