Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently installed postfix on Ubuntu Natty. I'm having a problem with the configuration.

Firstly here is my postfix configuration file:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
myorigin = /etc/mailname

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_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.

mydomain = $myorigin
myhostname =

alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this specifies where the virtual mailbox folders will be located
virtual_mailbox_base = /var/spool/mail/virtual
# this is for the mailbox location for each user
virtual_mailbox_maps = mysql:/etc/postfix/
# and this is for aliases
virtual_alias_maps = mysql:/etc/postfix/
# and this is for domain lookups
virtual_mailbox_domains = mysql:/etc/postfix/
# this is how to connect to the domains (all virtual, but the option is there)
# not used yet
# transport_maps = mysql:/etc/postfix/
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

mydestination = $myorigin, $myhostname, localhost.localdomain, , localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
#mynetworks_style = host

unknown_local_recipient_reject_code = 550
maximal_queue_lifetime = 7d
minimal_backoff_time = 1000s
maximal_backoff_time = 8000s
smtp_helo_timeout = 60s
smtpd_recipient_limit = 16
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 12

# Requirements for the HELO statement
smtpd_helo_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_hostname, reject_invalid_hostname, permit
# Requirements for the sender details
smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_$
# Requirements for the connecting server
smtpd_client_restrictions = reject_rbl_client, reject_rbl_client, reject_rbl_client dnsbl.n$
# Requirement for the recipient address
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_do$

# require proper helo at connections
smtpd_helo_required = yes
# waste spammers time before rejecting them
smtpd_delay_reject = yes
disable_vrfy_command = yes

Here is also my /etc/postfix/aliases:

# See man 5 aliases for format
postmaster:    root

Here is also my /etc/mailname:

I've also updated my hostname to

However, when I run postalias /etc/postfix/aliases I get the following :

postalias: warning: valid_hostname: invalid character 47(decimal): /etc/mailname
postalias: fatal: file /etc/postfix/ parameter mydomain: bad parameter value: /etc/mailname

Is there something I'm doing wrong?! I noticed that when I replace myorigin = /etc/mailname with myorigin = in my postfix config, I don't see any errors anymore after calling postalias. Is this a bug or something?!

share|improve this question
You may have encoding problem or invisible characters in the file /etc/mailname. Try to see its contents using cat -A /etc/mailname. You can also try to remove the file and recreate it again. – Khaled Dec 30 '11 at 17:54
@Khaled Here's what I get when I use the cat operation you listed$. Is that a problem? – Obi Hill Dec 30 '11 at 19:05
No, it should be fine. Did you try to remove/recreate the file? – Khaled Dec 30 '11 at 20:04

You are not allowed to specify

mydomain = $myorigin

You can do either remove the setting completely or specify a valid entry like But you are not allowed to use variables like $myorigin!

If you want it to be "dynamic" configurable by an external file, then you have to remove mydomain and myhostname completely. In this case the domain will be extracted from the hostname and the hostname will be extracted from /etc/hosts (better: by the gethostname() system call)

See the first three lines of your why you now experience a Debian-Postfix "bug". But Debian/Ubuntu intentionally hack Postfix to allow this stupid things. But they didn't think about the consequences of using this hack via Postfix $variables. Complain at Debian, not Postfix!

share|improve this answer
If you want to be "dynamic", it's better to just use one of the "virtual mail howto's" in the first place (postfix/dovecot + database) (my preference). See: as one example. – bshea Jul 18 at 16:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.