I have setup a local mail server using Postfix for test purposes. I have followed this tutorial to setup a 'Local only' Postfix mail server and I have also installed Thunderbird for testing.

The mail server works fine when I'm sending an email to another localhost address, for instance I've used localhost.com as the domain name and when I'm sending it to random_user@localhost.com it is always sent to the inbox of the default user. But the moment I try to send mail to say a Gmail address Postfix tries to send the email to gmail.com which results in the error Recipient address rejected: gmail.com. So it removes the <user>@ part from the email address and I don't understand why.

I need the mail server to be able to send outbound mails only, I've tried following the instructions on this link http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client but I can't find out what my machine name is (postconf -d myhostname" does not work).

Here are the configurations that I have now:


# See /usr/share/postfix/main.cf.dist for a commented, more complete version

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

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = maurice-HP-ProDesk-400-G4-MT.fun.local
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = system_mail_name, $myhostname, maurice-HP-ProDesk-400-G4-MT, localhost.localdomain, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = error
relay_transport = error
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual

virtual file

@localhost maurice
@localhost.com maurice
  • Which purpose serves a default_transport = error? Oct 31, 2019 at 11:16
  • i dont know, i copied the settings from the tutorial Oct 31, 2019 at 13:40
  • At least that is honest. Oct 31, 2019 at 13:45

1 Answer 1


This error is probably produced not by gmail, but by your own server. It is the error transport which produces the error. man error says:

Depending on the service name in master.cf, error or retry, the server bounces or defers all recipients in the delivery request using the "next-hop" information as the reason for non-delivery.

next-hop information is gmail.com in your case

I say "probably" because you provided only the part of the log-line.

Remove this default_transport = error. Let it be the default, smtp. The only thing it does for certain is disabling outgoing traffic completely.

There could be other complications in this setup, but I can't see them with the naked eye. It seems better to begin configuring with the default config rather that with some obscure tutorial.

  • it works! thank yoouuu! Oct 31, 2019 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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