Sendgrid SMTP Relay Configuration Using Postfix in SAP S/4HANA
In this blog post I have explained about how to use / configure Sendgrid as SMTP relay in SAP S/4HANA using postfix mail package in Redhat linux.
Environment Details :
Linux Version : Red Hat Enterprise Linux Server 7.6
SAP S/4HANA 1909 FPS 00
HANA 2.0 SP04
Install Postfix in Redhat Linux
Check Postfix is installed
# rpm -qa | grep postfix
Install Postfix
# yum install -y postfix
# systemctl start postfix
# systemctl enable postfix
# systemctl status postfix
Postfix status should be active (running)
Steps to be carried in Linux server:
Take backup of below files from /etc/postfix
1. main.cf
2. sasl_passwd (If already available)
# cd etc/postfix
# cp main.cf main_bkp.cf
# cp sasl_passwd sasl_passwd_bkp
Add below lines in main.cf file
# cd etc/postfix
# vi main.cf
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
— Save —
Edit sasl_passwd
Note: You should have sendgrid account details to proceed further.
# vi sasl_passwd
[smtp.sendgrid.net]:587 sendgridUsername:SendgridPassword
Note: Sendgrid login account details is username & password.
# sudo chmod 600 /etc/postfix/sasl_passwd
# sudo postmap /etc/postfix/sasl_passwd
# sudo systemctl restart postfix
Check postfix status,
# sudo systemctl status postfix
Test Using Unix Command:
Create file
# vi /tmp/test.txt
— Type any content in the text file —
Example :
SMTP Mail Configuration Using Sendgrid Completed Successfully !
— Save —
mail -s “Sendgrid Configuration Mail” example@gmail.com < /tmp/test.txt