- Show all Docs ( 243 ) Collapse Docs
- Show all Docs ( 23 ) Collapse Docs
How to send an E-mail from CentOS 7
Postfix is a flexible mail server that is available on most Linux distribution. Though a full feature mail server, Postfix can also be used as a simple relay host to another mail server, or smart host.
Step 1. Login to your server via SSH Putty.
Step 2. Install Postfix, the SASL authentication framework, and mailx.
# yum -y install postfix cyrus-sasl-plain mailx
Step 3. Restart Postfix to detect the SASL framework.
# systemctl restart postfix
Step 4. Start Postfix on boot
# systemctl enable postfix
Step 5. Open the /etc/postfix/main.cf file.
# vi /etc/postfix/main.cf
Paste the following into the file:
Save and Exit.
Step 6. Configure Postfix SASL Credentials
Add the Gmail credentials for authentication. Create a "/etc/postfix/sasl_passwd" file
# touch /etc/postfix/sasl_passwd
Add the following line to the file:
Save and exit.
NOTE: Replace username with your Gmail ID and password with your Gmail Password
Step 7. Create a Postfix lookup table from the sasl_passwd text file by running the following command:
# postmap /etc/postfix/sasl_passwd
Step 8. Sending mail
Run the following command to send mail:
# echo "This is test mail." | mail -s "message" firstname.lastname@example.org
NOTE: 'email@example.com' can be any Mail ID that the user wants to send email to.
'This is test mail' is the Body Message of the Email. Customizable according to the user.
'message' is the Subject of the Email. Customizable according to the user.
Step 9. Mail received.