<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Postfix on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/postfix/</link>
    <description>Recent content in Postfix on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Fri, 05 Dec 2014 14:03:53 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/postfix/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Install Postfix with mail forwarding</title>
      <link>https://janikvonrotz.ch/2014/12/05/install-postfix-with-mail-forwarding/</link>
      <pubDate>Fri, 05 Dec 2014 14:03:53 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/12/05/install-postfix-with-mail-forwarding/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/janikvonrotz/b6bbaee6433e5d4d2771&#34;&gt;https://gist.github.com/janikvonrotz/b6bbaee6433e5d4d2771&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;Postfix is a commonly used MTA (Mail Transfer Agent) program that can receive, deliver or route emails. In this guide you&amp;rsquo;ll learn how to forward mails from a certain domain to another e-mail address. It&amp;rsquo;s a recommanded approach if you want to publish a mail contact based on your domain and redirect the received mails to another provider, such as Outlook or Gmail.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;installation&#34;&gt;Installation&lt;/h1&gt;&#xA;&lt;p&gt;Install Postfix with aptitude.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo apt-get install postfix&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the wizard chose as showed below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Setup type: Internet Site&#xA;System mail name: &amp;lt;domain&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After the installation check, wether the Postfix agent is running or not.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service postfix status&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Verfify your mail DNS records. Here&amp;rsquo;s an example.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;example.org.  85100  IN  MX  10 mail.example.org&#xA;mail.example.org.  85045  IN  CNAME  example.org&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Also Verifiy open Ports, postfix is accessable via these ports.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;smtp port 25&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;We assume the mail server runs on the web server.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s configure the postfix server.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /etc/postfix/main.cf&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Add at these line at the end of the file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# acceptable mail domains for postifx&#xA;virtual_alias_domains = example.org example.com&#xA;virtual_alias_maps = hash:/etc/postfix/virtual&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Lets add some mail forwarding rules&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi /etc/postfix/virtual&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can add your mail adresses, here&amp;rsquo;s an exmaple with gmail.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;contact@example.org name@gmail.com&#xA;sales@example.com name@gmail.com sombodyelse@gmail.com&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Update the postfix lookup table&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo postmap /etc/postfix/virtual&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Restart the postix service&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service postfix reload&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And last check wether the config has been load propberly&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;postconf -n | grep virtual&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You should see the virtual config instructions&lt;/p&gt;&#xA;&lt;h1 id=&#34;source&#34;&gt;Source&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.binarytides.com/postfix-mail-forwarding-debian/&#34;&gt;Setup mail forwarding in postfix on Ubuntu or Debian&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
