LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

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)

Jarland

14 Comments

  1. 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

    January 4, 2016 @ 7:38 am | Reply
    • Jarland Donnell:

      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 :)

      January 4, 2016 @ 8:27 am | Reply
  2. 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.

    January 4, 2016 @ 5:00 pm | Reply
  3. ssmtp is a nice lowend solution to get mail from your vps.

    January 4, 2016 @ 5:01 pm | Reply
  4. Nick:

    Send-only for Debian :)

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

    DONE!

    January 5, 2016 @ 1:34 am | Reply
  5. I will practice this in my server but If I cannot do it I will ask here

    April 27, 2016 @ 3:21 pm | Reply
  6. Nice Bro
    Blogwalking dont forget

    June 9, 2016 @ 4:32 am | Reply
  7. also make sure that you have a valid Reverse DNS record for your VPS ip address

    July 31, 2016 @ 11:03 am | Reply
  8. for me who does not understand the ubuntu is very useful for me

    August 27, 2016 @ 7:54 pm | Reply
  9. ssmtp is a nice lowend solution to get mail from your vps.

    February 20, 2017 @ 8:49 am | Reply
  10. also make sure that you have a valid Reverse DNS record for your VPS ip address

    August 5, 2017 @ 12:17 pm | Reply
  11. I’m Not Understand But I’m not understand with this article and very help me.

    August 21, 2017 @ 3:54 am | Reply
  12. thanks. very helpful for beginners like me

    September 6, 2017 @ 9:55 am | Reply
  13. 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 …

    September 13, 2017 @ 8:54 pm | Reply

Leave a Reply to hamid Cancel reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

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