How to Configure a Linux Server to Send E-mail

If you’re looking to set up a Linux box all by yourself, you’ll want to configure an e-mail server sooner or later. This seems like it should be a simple job, but it’s not. The e-mail architecture can be bewilderingly complex, with dozens upon dozens of options and things that can go wrong. No surprise then, that we have dedicated mail server administrators whose sole job it is to know the ins and outs of e-mail infrastructure.
However, there are times when we don’t care about the bells and whistles and just want to do one thing – send and receive e-mail. Sometimes we don’t care about security, features like passwords, virtual users, mailboxes, SMTP, POP etc. We want the ability to go to a terminal, type in a single command and send an e-mail. One of the ways to eventually build up to a complete mail solution is to start small. Start with the basics, test it, and then move ahead. As we progress, we can build up features like spam filtering etc.
But in this tutorial, we’re going to do just one thing – send an email without too much configuration and effort. Most tutorials for mail that you’ll find on the Internet involve installing lots of software, opening files and configuring a large number of settings, along with setting up SSL certificates etc. But here, we’re going to bypass all that and just rely on the basics.

Sending Mail is Useful for Server Alerts

In case you’re wondering what use we can have for such a simple e-mail system, the first use-case that comes to mind is server alerts. You have a lot of events on a server that you might want to be notified about. An important cron job for example. Or perhaps you want a certain log file to be sent to your e-mail ID at periodic intervals. Or a warning about when your disk space is getting low. Any of these can be configured as an e-mail message to the administrator. And here’s how to get started.

Step 1: Install postfix and mailx

The two basic packages we’re going to need are postfix and mailx. I’m not going into what they’re supposed to do. That can be quite a complicated mess in itself with lots of terminology that needs careful explaining. Just enter the following command into your CentOS terminal to install them:
Change up this command depending on your particular flavor of Linux. Use “apt-get” for Ubuntu instead of yum etc etc. Here are the two packages that are installed with the above command:

Comments

chik cchaa said…
You are a very persuasive writer. I can see this in your article.
webcare360.com
You have a way of writing compelling information that sparks much interest.

Popular posts from this blog

Web Hosting Coupon Codes

Deadpool (2016)

How to Locate the PHP File Containing a Tag in WordPress