Tag Archives: postfix

Setup mail client on CentOS 7


A lot of people often need to be able to send e-mail from a server at home. For instance, you may be running a Raspberry Pi that is monitoring something or doing something fun such as filming or taking pictures of your neighbor. I wrote this small guide as it is probably the easiest way of doing it for CentOS 7.

1. To start with, you probably have an ISP with an e-mail server, such as smtp.yourisp.com. This will be needed later in step 4 of the guide.

2. Make sure postfix is installed. Or else, yum install postfix. At the time of writing this is what I am running.

[root@serv1 ~]# yum list installed|grep postfix
postfix.x86_64 2:2.10.1-6.el7 @anaconda

3. Backup your /etc/postfix/main.cf file to /etc/postfix/main.cf.bk

4. Edit the file /etc/postfix/main.cf and change the following settings:

myorigin = server.yourdomain.com
mydestination = server.yourdomain.com, localhost
relayhost = smtp.yourisp.com

Where server.yourdomain.com can be something like serv1.mycooldomain.com or whatever the name is of your own domain.

5. Restart postfix, service postfix restart

6. Try it by doing something like this, if you want to monitor your RAID

/usr/sbin/mdadm --detail /dev/dm-1 > /root/RAID_STATUS.log
/bin/mail -s "RAID STATUS" "your-email@domain.com" < /root/RAID_STATUS.log