Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Last active November 7, 2022 15:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/b6bbaee6433e5d4d2771 to your computer and use it in GitHub Desktop.
Save janikvonrotz/b6bbaee6433e5d4d2771 to your computer and use it in GitHub Desktop.
Ubuntu: Install Postfix with mail forwarding #Ubuntu #Markdown #Postfix

Introduction

Postfix is a commonly used MTA (Mail Transfer Agent) program that can receive, deliver or route emails. In this guide you'll learn how to forward mails from a certain domain to another e-mail address. It'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.

Requirements

Installation

Install Postfix with aptitude.

sudo apt-get install postfix

In the wizard chose as showed below.

Setup type: Internet Site
System mail name: <domain>

After the installation check, wether the Postfix agent is running or not.

sudo service postfix status

Verfify your mail DNS records. Here's an example.

example.org.  85100  IN  MX  10 mail.example.org
mail.example.org.  85045  IN  CNAME  example.org

Also Verifiy open Ports, postfix is accessable via these ports.

smtp port 25

We assume the mail server runs on the web server.

Let's configure the postfix server.

sudo vi /etc/postfix/main.cf

Add at these line at the end of the file.

# acceptable mail domains for postifx
virtual_alias_domains = example.org example.com
virtual_alias_maps = hash:/etc/postfix/virtual

Lets add some mail forwarding rules

sudo vi /etc/postfix/virtual

Now you can add your mail adresses, here's an exmaple with gmail.

contact@example.org name@gmail.com
sales@example.com name@gmail.com sombodyelse@gmail.com

Update the postfix lookup table

sudo postmap /etc/postfix/virtual

Restart the postix service

sudo service postfix reload

And last check wether the config has been load propberly

postconf -n | grep virtual

You should see the virtual config instructions

Source

Setup mail forwarding in postfix on Ubuntu or Debian

@Miangee123
Copy link

Miangee123 commented Nov 7, 2022

A personal computer game, also known as a PC game or computer game, is a type of video game played on a personal computer (PC) rather than a video game console or arcade machine.

@Miangee123
Copy link

The application of scientific knowledge to the practical aims of human life or, as it is sometimes phrased, to the change and manipulation of the human environment.

@Miangee123
Copy link

Most people have some kind of insurance: for their car, their house, or even their life. Yet most of us don’t stop to think too much about what insurance is or how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment