Total Pageviews

Thursday, 2 June 2016

Send and Receive Mail from Your VPS

Start by going to your DNS provider (often your domain name registar) and adding an MX record pointing to your VPS host name. If you only have one mail server, you can arbitrarily assign it a preference of 10.

To allow for the possibility of sending and receiving encrypted mail, we will start by installing the GPG software and generating a public-private key pair:

When --gen-key runs, you can use the defaults: RSA, 2048 bits, and 0 expiry. Enter your real name, your email address (userid@yourdomain.com, though it will not exist as an email account at this point), and leave the comment blank. When prompted, enter a passphrase that will protect access to your private key.

Install the Mutt mail client:

sudo apt-get install mutt

(Depending on your operating system, you may be asked to configure Postfix at this point. Since we are not using Postfix, ignore any prompts and set the configuration to “No configuration” if necessary.)

Copy the sample GPG parameters to your home directory:

cp /usr/share/doc/mutt/examples/gpg.rc .gpg.rc

Edit your personal Mutt configuration file:

vi .muttrc

Here is a Mutt configuration file you can use to get started (and which you can change as you learn more about Mutt):

set mbox_type=Maildir
set folder="~/Maildir"
set mask="!^\\.[^.]"
set mbox="~/Maildir"
set spoolfile="~/Maildir"
set sort=reverse-date-received
set sort_aux=reverse-date-received
set editor="vim"
source ~/.gpg.rc
set pgp_autosign=yes
set pgp_replyencrypt=yes
set pgp_replysign=yes
set pgp_replysignencrypted=yes