User Tools

Site Tools


Setting up a Postfix cloud-based SMTP smarthost for incoming and outgoing email

OK, so first of all. I installed Postfix:

   sudo apt-get install postfix

Incoming email

After that, I edited the /etc/postfix/ file to add the following:

   smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
   myhostname =
   #alias_maps = hash:/etc/aliases
   #alias_database = hash:/etc/aliases
   myorigin = /etc/mailname
   mydestination =
   relayhost =
   mynetworks = [::ffff:]/104 [::1]/128
   mailbox_size_limit = 0
   recipient_delimiter = +
   inet_interfaces = all
   inet_protocols = all
   local_recipient_maps =
   local_transport = error:local mail delivery is disabled
   virtual_alias_maps = hash:/etc/postfix/virtual
   relay_domains =,
   parent_domain_matches_subdomains = debug_peer_list smtpd_access_maps
   relay_recipient_maps =
   transport_maps = hash:/etc/postfix/transport

What this part did was allow me to specify aliases and destinations for my incoming email

Next stage was to create /etc/postfix/virtual and add some aliases:

   sudo nano /etc/postfix/virtual

After this, I need to tell Postfix where to deliver emails:

   sudo nano /etc/postfix/transport

Add the following:       smtp:[]:587	smtp:[]:587

After, issue the following 3 commands:

   sudo postmap /etc/postfix/transport
   sudo postmap /etc/postfix/virtual
   sudo postfix reload

At this stage, emails that come in will be delivered to their destination server. No Anti-Spam is active at this point, but you should be able to change your MX records to this host now.

setting_up_smtp_smarthost.txt · Last modified: 2017/03/22 23:19 (external edit)