Postfix Connection issues


I tried following … 0.04-lucid"> to get you started by the recommendation of @derfy.

The problem as I see it now is that I am unable to connect to Postfix. It seems as there is a setting missing to allow connections via the public IP Address.

Possibly someone can help me understand the problem at this point? I am not sure where/what I should be looking for.

The goal of this configuration is to allow mail to be 'relayed' via one specific account. Anything and EVERYTHING else should be ignored.

Thank you for your thoughts.

Example: Telnet to 25 works, but is slow to initially answer. and Telnet localhost 25 works nice and fast. Both send the email immediately. However Telnet results in "Connection closed by foreign host."

root@li369-146:~# telnet 25


Connected to

Escape character is '^]'.

Connection closed by foreign host.

root@li369-146:~# telnet 25
Connected to
Escape character is '^]'.
Connection closed by foreign host.
root@li369-146:~# telnet localhost 25
Connected to localhost.localdomain.
Escape character is '^]'.

220 ESMTP Postfix (Debian/GNU)
250 2.1.0 Ok
250 2.1.5 Ok
354 End data with <cr><lf>. <cr><lf>250 2.0.0 Ok: queued as 50F341CD1D
221 2.0.0 Bye
Connection closed by foreign host.</lf></cr></lf></cr> 
netstat -tap


root@li369-146:~# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:imaps                 *:*                     LISTEN      8574/dovecot
tcp        0      0 *:pop3s                 *:*                     LISTEN      8574/dovecot
tcp        0      0 localhost.localdo:mysql *:*                     LISTEN      7226/mysqld
tcp        0      0 *:pop3                  *:*                     LISTEN      8574/dovecot
tcp        0      0 *:imap2                 *:*                     LISTEN      8574/dovecot
tcp        0      0 *:ssh                   *:*                     LISTEN      1588/sshd
tcp        0      0 *:smtp                  *:*                     LISTEN      9961/master
tcp        0      0    TIME_WAIT   -
tcp        0    248    ESTABLISHED 10163/0
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1588/sshd

root@li369-146:~# cat /etc/postfix/
# See /usr/share/postfix/ 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 (Debian/GNU)
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 = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.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 =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost, localhost.localdomain
relayhost =
mynetworks =,
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
message_size_limit = 30720000
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/
virtual_mailbox_maps = proxy:mysql:/etc/postfix/
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

2 Replies

I get the same behavior here, too.

Try adding a '-v' to your 'smtp' setting in /etc/postfix/, like this: Then restart postfix and try to send mail again. The log (/var/log/mail.log) should have some useful information about why it is dropping people.

Edit: after testing, you'll want to remove from this line: > mynetworks =,

By putting that there, you allow to relay through your server.

No, change your mynetworks value NOW – that is what is causing the issue. is totally invalid ( != ), and as a result Postfix is refusing the connections entirely as it has no clue what you really meant. Change it to a /32 and restart Postfix.

I suspect your issue will immediately be resolved.

mynetworks =,

or even:

mynetworks =,


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct