Tutorials

Mail Enable Websites Hosted on Your Ubuntu VPS with Postfix

In order to enable your website to send e-mails, you will need to install additional components to facilitate this service. On your Linux VPS, many system administrators choose Postfix.

Getting Started with Postfix on your VPS

The first step consists of connecting to your server using SSH. If you’re on Linux or Mac, you’ll do this by typing this at your terminal:

ssh username@X.X.X.X

Where username is the user and X.X.X.X is the IP address of your Ubuntu server. You will then be asked for your password and you’ll notice that the connection is successful.

If you are using a Windows, it’s best to establish a virtual terminal session over SSH using a program called PuTTy.

Once you are logged into the server, it’s best to obtain the root rights using the following command:

sudo bash

Please enter the password in order to enable root mode. We are now ready to install postfix using the following command:

apt-get install postfix

You will need to press “Y” and press Enter in order to start the download and installation of all the necessary dependencies. Once started, the installer script will display some information. Read on and then press “OK”.

Select Configuration Options for Postfix

You will be now asked to choose a configuration for your new Postfix server. In this case we will select “Internet Site“ using the Up and Down arrow to navigate, Tab to move to OK and then press Enter.

In the next step, you will be asked for the Fully Qualified Domain Name (FQDN) of your VPS. It is a best practice to use the correct FQDN since this will be provided by the server when it will connect to other servers in order to send mails.

Advanced Configurations for Postfix

Once each of those steps are complete, all you will need to do is wait for the process to finish up. It should take less than a minute. The mail server should also start automatically, but to be sure, you can run the following command:

netstat –na | grep :25

This should provide one of more lines depending if you have IPv6 enabled on your server. To make sure all configurations have been loaded properly after a change in the configuration file, it will always be necessary restarting Postfix service using the following command:

/etc/init.d/postfix restart

Don’t forget to enable the Postfix servers to start automatically at the startup of the server. Do this using the following command:

update-rc.d postfix enable

Once you have completed these steps your server will be ready and enabled to send emails.

Important: The Postfix Log Files

In case you encounter issues when attempting to send email from the websites hosted on your VPS, you can rapidly check the log file using the following command:

tail -f /var/log/mail.log

(Tutorial written by third party, not by Jarland Donnell)

14 Comments

  1. Marcos's avatar
    Marcos

    I’m glad I saw this line “(Tutorial written by third party, not by Jarland Donnell)”. Tutorial is horrible.

    Suggestion for Jarland, create another user to post 3rd party tutorial. So that your name will not be associated with such posts

    • Jarland's avatar
      Jarland Donnell Author

      It’s not meant to shock anyone with it’s incredible content really, this is merely to build up useful, situational tutorial content. I thought it did a fine job of getting to the point and getting the job done 🙂

  2. Dave's avatar
    Dave

    Also, please make sure that you add/update your DNS(spf) TXT record to reflect that your particular VPS ip address is “allowed” to send e-mail for your domain, and also make sure that you have a valid Reverse DNS record for your VPS ip address. These last two steps should allow your mail to avoid the SPAM folder.

  3. Stuart's avatar
    Stuart

    ssmtp is a nice lowend solution to get mail from your vps.

  4. Nick's avatar
    Nick

    Send-only for Debian 🙂

    apt-get install exim4-daemon-light
    dpkg-reconfigure exim4-config

    DONE!

  5. Carabikin's avatar
    Carabikin

    I will practice this in my server but If I cannot do it I will ask here

  6. reparasi sofa di bandung's avatar
    reparasi sofa di bandung

    Saying “thank you” is a great way to make your email more polite. … makes the reader feel appreciated, which is very important if you want them …

Leave a Reply

Before you comment
  • Please use your hosting provider's support system for service issues.
  • Comments may be held temporarily for spam review.
  • Use <pre>...</pre> for terminal output, or link to a paste service.

Your email address will not be published. Required fields are marked *