Jump to content

- - - - -

Mail Enable Websites Hosted on Your Ubuntu VPS with Postfix

  • Please log in to reply
No replies to this topic

#1 Pirate Tony

Pirate Tony

    Advanced Member

  • Members
  • PipPipPip
  • 291 posts

Posted 12 June 2016 - 04:07 PM

 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 [email protected]

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users