-1

I just did a fresh install of Postfix and courier on a ubuntu 12.04 machine

the mail server appears to be working from the inside until you try to send an email from an external address (like gmail).

The apache, mysql, etc on the same server are all functioning correctly internally and externally.

reverse lookup returns correctly.

netstat -nl returns

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:993             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:995             0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:110             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN
tcp        0      0 173.255.238.79:53       0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN 
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:2905          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN
tcp6       0      0 :::993                  :::*                    LISTEN
tcp6       0      0 :::995                  :::*                    LISTEN
tcp6       0      0 :::110                  :::*                    LISTEN
tcp6       0      0 :::143                  :::*                    LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::53                   :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:5432                :::*                    LISTEN
tcp6       0      0 :::25                   :::*                    LISTEN
tcp6       0      0 ::1:953                 :::*                    LISTEN
tcp6       0      0 :::4190                 :::*                    LISTEN

etc/postfix/main.cf is

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 = /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 = fasttrackdispatch.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = fasttrackdispatch.com, localhost, localhost.localdomain
relayhost = 
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains = 
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
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
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = 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
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

when looking at mail.log nothing appears showing the message was received or denied - it is almost like it never was sent

The sender DOES NOT receive any kind of message back stating a denied request or any kind of error occurred.

I tried to open port 25 on ubuntu firewall and then just turned the firewall off to see if that would work with no avail.

Any help is appreciated - Thanks

I am really unsure of what is going on - any help is appreciated.

Now inet_interface = all I am receiving a return mail when sending mail to that address

This is the mail system at host fasttrackdispatch.com.

I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can delete your own text from the attached returned message.

               The mail system

<email@domain.tld>: unknown user: "james.stafford"

Final-Recipient: rfc822; email@domain.tld
Original-Recipient: rfc822;email@domain.tld
Action: failed
Status: 5.1.1
Diagnostic-Code: X-Postfix; unknown user: "james.stafford"

I don't understand why it says it is an unknown user when it is in fact a set up account which works internally

new mail.log

Jan 22 14:31:47 localhost postfix/smtpd[14264]: connect from mail-wi0-f178.google.com[209.85.212.178]
Jan 22 14:31:47 localhost postfix/trivial-rewrite[14267]: warning: do not list domain fasttrackdispatch.com in BOTH mydestination and virtual_mailbox_domains
Jan 22 14:31:47 localhost postfix/smtpd[14264]: BF9C4B64C: client=mail-wi0-f178.google.com[209.85.212.178]
Jan 22 14:31:47 localhost postfix/cleanup[14270]: BF9C4B64C: message-id=<CAE0rcYX=LwLJOUVnaaCvv33xnMxBXXonUt-8ncV06e9v+SST6w@mail.gmail.com>
Jan 22 14:31:47 localhost postfix/qmgr[13856]: BF9C4B64C: from=<email@domain.tld>, size=1806, nrcpt=1 (queue active)
Jan 22 14:31:48 localhost postfix/smtpd[14264]: disconnect from mail-wi0-f178.google.com[209.85.212.178]
Jan 22 14:31:53 localhost postfix/smtpd[14276]: connect from localhost[127.0.0.1]
Jan 22 14:31:53 localhost postfix/trivial-rewrite[14267]: warning: do not list domain fasttrackdispatch.com in BOTH mydestination and virtual_mailbox_domains
Jan 22 14:31:53 localhost postfix/smtpd[14276]: B128DB64D: client=localhost[127.0.0.1]
Jan 22 14:31:53 localhost postfix/cleanup[14270]: B128DB64D: message-id=<CAE0rcYX=LwLJOUVnaaCvv33xnMxBXXonUt-8ncV06e9v+SST6w@mail.gmail.com>
Jan 22 14:31:53 localhost postfix/qmgr[13856]: B128DB64D: from=<email@domain.tld>, size=2378, nrcpt=1 (queue active)
Jan 22 14:31:53 localhost postfix/smtpd[14276]: disconnect from localhost[127.0.0.1]
Jan 22 14:31:53 localhost postfix/trivial-rewrite[14267]: warning: do not list domain fasttrackdispatch.com in BOTH mydestination and virtual_mailbox_domains
Jan 22 14:31:53 localhost amavis[11815]: (11815-04) Passed CLEAN, [209.85.212.178] [209.85.212.178] <email@domain.tld> -> <email@domain.tld>, Message-ID: <CAE0rcYX=LwLJOUVnaaCvv33xnMxBXXonUt-8ncV06e9v+SST6w@mail.gmail.com>, mail_id: gdtQkyTU2m1h, Hits: -0.799, size: 1806, queued_as: B128DB64D, dkim_id=@gmail.com, 5753 ms
Jan 22 14:31:53 localhost postfix/smtp[14271]: BF9C4B64C: to=<email@domain.tld>, relay=127.0.0.1[127.0.0.1]:10024, delay=6.1, delays=0.34/0.01/0/5.8, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as B128DB64D)
Jan 22 14:31:53 localhost postfix/qmgr[13856]: BF9C4B64C: removed
Jan 22 14:31:53 localhost postfix/local[14278]: B128DB64D: to=<email@domain.tld>, relay=local, delay=0.04, delays=0.01/0.02/0/0.01, dsn=5.1.1, status=bounced (unknown user: "james.stafford")
Jan 22 14:31:53 localhost postfix/cleanup[14270]: BA7FAB64E: message-id=<email@domain.tld>
Jan 22 14:31:53 localhost postfix/qmgr[13856]: BA7FAB64E: from=<>, size=4322, nrcpt=1 (queue active)
Jan 22 14:31:53 localhost postfix/bounce[14279]: B128DB64D: sender non-delivery notification: BA7FAB64E
Jan 22 14:31:53 localhost postfix/qmgr[13856]: B128DB64D: removed
Jan 22 14:31:56 localhost postfix/smtp[14280]: BA7FAB64E: to=<jhstaffo@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.137.27]:25, delay=2.7, delays=0.01/0.01/0.58/2.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1390401116 g10si11097167yhn.109 - gsmtp)
Jan 22 14:31:56 localhost postfix/qmgr[13856]: BA7FAB64E: removed

3 Answers3

2

Like NickW says, looks like inet_interfaces is the problem. http://www.postfix.org/postconf.5.html#inet_interfaces

You has:

    inet_interfaces = loopback-only

This is ok if you only need to send/receiving mails from local applications, applications are executed on the main server. That's why you don't see nothing on the log file, postfix never receive the connection.

But if you want to "listen" external connections you need some like:

    inet_interfaces = all

So you will listen the port 25 in all interfaces, not only lo interface.

1

Why do you have inet_interfaces set to loopback only?

NickW
  • 10,183
  • 1
  • 18
  • 26
1

please check if the mapping of the user table did work correctly.

as i have a similiar setup (virtual user/domain with mysql) i had issues with using the correct syntax/query for the user request.

for now i would check if the user has actually a folder on the server.

you use uid 5000 which could mean you used some setup where the user under which all virtual users are created is named vmail. if this is the case your setup (domains/username) should contain something similiar to this:

/home/vmail/domain.tld/virtual_username

check if this folder exists and has a few folder or files in it.

if it does not exists your query for returning the username might be wrong:

mine does /etc/postfix/mysql-virtual_mailboxes.cf) does look like this:

 user = DB_accessuser
 password = XXXX
 dbname = mail
 table = users
 select_field = CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
 where_field = email
 hosts = 127.0.0.1

additionally : what do you mean by the usage of "setup an account which works internally"

your mailserver seems to not know the account, which leds me believe it is not in the virtual_mailboxes list, though i do not know if you could just access an actual "real" user with your above setup. On mine this does not work "realuser@domain.tld" does not work, where "virtual_user@domain.tld" works fine.

responding to your addition of the mail log:

the fix should be this (qoute from howtoforge):

Error: Postfix - do not list domain example.com in BOTH mydestination and virtual_mailbox_domains

You have example.com in the resource (for example a MySQL database) referenced in the virtual_mailbox_domains directive in /etc/postfix/main.cf AND in the mydestination line (also in /etc/postfix/main.cf)! This doesn't work. You can list example.com either in virtual_mailbox_domains or in mydestination, but not in both.

after the change restart Postfix

/etc/init.d/postfix restart 
Dennis Nolte
  • 2,848
  • 4
  • 26
  • 36