0

I have to create a forwarding mail account on a Ubuntu system using Postfix.

I have scoured Google and everything I've found seems to point at doing all of this work through MySQL. According to ps -aux | grep mysql, MySQL is not even running. Hence, Postfix must be using some other method for managing such things.

I don't know much about Postfix and not finding straight answers is beginning to fray my patience.

Here's my main.cf followed by my virtual file's contents:


smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = maindomain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = maindomain.com, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_alias_domains = maindomain.com
virtual_alias_maps = hash:/etc/postfix/virtual

virtual file

shop@maindomain.com    party1@another-domain.com, party2@yet-another-domain.com
Skittles
  • 421
  • 1
  • 7
  • 16
  • So you want one account that forwards all the mail addressed to it somewhere else? Or you want to set up a system where you can create X accounts that all forward mail somewhere else, or where a user can decide to forward mail to gmail one day and yahoo the next and both the third? – DerfK Oct 13 '11 at 16:08
  • Sorry...There is an installation already on the hosting server. I need to basically create an account on that server that will forward all email to two recipients on remote mail servers. (e.g. shop@this-domain.com forwards to person1@that-domain.com & person2@another-domain.com) – Skittles Oct 13 '11 at 16:27
  • If you have a configuration then why not read the configuration? Or let us see the configuration? Otherwise I have to point you to [virtual_alias_maps](http://www.postfix.org/postconf.5.html#virtual_alias_maps) which does the trick. – mailq Oct 13 '11 at 18:54
  • Here's my main.cf followed by my virtual file's contents: – Skittles Oct 14 '11 at 13:14

2 Answers2

0

You're in the right direction, however the layout of your virtual file seems flawed. A hash file looks like this (in your case):

shop@maindomain.com:  party1@another-domain.com
shop@maindomain.com:  party2@yet-another-domain.com

When you're done editing, run postmap <hashfile> to generate the database.

ΤΖΩΤΖΙΟΥ
  • 1,048
  • 1
  • 10
  • 19
Flash
  • 1,310
  • 7
  • 13
  • Flash, thank you so much for the response. I changed the virtual file as you directed and when I ran postmap, it gave me this error; "postmap: warning: /etc/postfix/virtual, line 1: record is in "key: value" format; is this an alias file?" Should I maybe be using the virtual_maps directive in my main.cf instead of virtual_alias_maps? – Skittles Oct 14 '11 at 14:14
0

Perhaps you only need to create a line in /etc/aliases:

shop@mydomain.com party1@another-domain.com party2@yet-another-domain.com

and then just run sudo newaliases.

It's possible that shop@mydomain.com can be shortened to shop.

ΤΖΩΤΖΙΟΥ
  • 1,048
  • 1
  • 10
  • 19