mail to domain bounced, to hostname accepted

Discussion in 'Server Operation' started by bluethundr, Nov 28, 2011.

  1. bluethundr

    bluethundr New Member

    Hello,

    I have setup a new postfix sertver and when I send mail to the domain (crispycode.com) the mail will bounce. If I send to the mail host name (mail.crispycode.com) the mail is shown as delivered in the logs. However if you inspect the cur directory on the command line in the user's virtual home directory it's empty and nothing shows up in the squirrelmail interface INBOX. I have virtual users and domains stored in a mysql database.

    This is what I see in the logs when I send to mail.crispycode.com

    First I try a telnet session sending mail to the intended recipient. It is bounced.

    Code:
    [root@mail ~]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 mail.crispycode.com ESMTP Postfix
    HELO MAIL
    250 mail.crispycode.com
    MAIL FROM: <[email protected]>
    250 2.1.0 Ok
    RCPT TO: <[email protected]>
    250 2.1.5 Ok
    DATA
    354 End data with <CR><LF>.<CR><LF>
    Subject: Testing
    test test test
    .
    250 2.0.0 Ok: queued as 41C6324F9F
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.
    
    Then I grep the message ID from the maillog and this is what I see:

    Code:
    [root@mail ~]# grep 41C6324F9F /var/log/maillog
    Nov 27 23:27:43 mail postfix/smtpd[18001]: 41C6324F9F: client=localhost[127.0.0.1]
    Nov 27 23:27:56 mail postfix/cleanup[18010]: 41C6324F9F: message-id=<[email protected]>
    Nov 27 23:27:56 mail postfix/qmgr[17871]: 41C6324F9F: from=<[email protected]>, size=378, nrcpt=1 (queue active)
    Nov 27 23:27:56 mail postfix/smtp[18013]: 41C6324F9F: to=<[email protected]>, relay=none, delay=25, delays=25/0.01/0/0, dsn=5.4.6, status=bounced (mail for 127.0.0.1 loops back to myself)
    Nov 27 23:27:56 mail postfix/bounce[18015]: 41C6324F9F: sender non-delivery notification: B9C0D24FA1
    Nov 27 23:27:56 mail postfix/qmgr[17871]: 41C6324F9F: removed
    

    If I try a telnet SMTP session that sends mail to the user [email protected] the logs report the mail is delivered but there is evidence of the mail file (which should include the message id) on the file system.

    Code:
    [root@mail ~]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 mail.crispycode.com ESMTP Postfix
    HELO mail
    250 mail.crispycode.com
    MAIL FROM: <[email protected]>
    250 2.1.0 Ok
    RCPT TO: <[email protected]>
    250 2.1.5 Ok
    DATA
    354 End data with <CR><LF>.<CR><LF>
    Subject: test
    test
    .
    250 2.0.0 Ok: queued as A6F3F24F9F
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.
    
    The logs report that the message is delivered:

    Code:
    [root@mail ~]# grep A6F3F24F9F /var/log/maillog
    Nov 27 23:36:59 mail postfix/smtpd[18024]: A6F3F24F9F: client=localhost[127.0.0.1]
    Nov 27 23:37:08 mail postfix/cleanup[18033]: A6F3F24F9F: message-id=<[email protected]>
    Nov 27 23:37:08 mail postfix/qmgr[17871]: A6F3F24F9F: from=<[email protected]>, size=369, nrcpt=1 (queue active)
    Nov 27 23:37:08 mail postfix/local[18045]: A6F3F24F9F: to=<[email protected]>, relay=local, delay=36, delays=36/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
    Nov 27 23:37:08 mail postfix/qmgr[17871]: A6F3F24F9F: removed
    
    
    And even tho the logs are claiming message ID A6F3F24F9F was delivered there is no evidence of it anywhere on the file system.

    Code:
    [root@mail ~]# ls -l /home/vmail/crispycode.com/bluethundr/cur/
    total 0
    

    This is how I have my virtual domains and users defined in the database:

    Code:
    Database changed
    mysql> select * from domains;
    +---------------------+
    | domain              |
    +---------------------+
    | crispycode.com      |
    | mail.crispycode.com |
    +---------------------+
    2 rows in set (0.00 sec)
    
    
    mysql> select * from users;
    +--------------------------------+---------------+----------+
    | email                          | password      | quota    |
    +--------------------------------+---------------+----------+
    | [email protected]      | BLAH          | 10485760 |
    | [email protected] | BLAH        | 10485760 |
    +--------------------------------+---------------+----------+
    2 rows in set (0.00 sec)
    
    


    And this is the output of postconf -n

    Code:
    [root@mail ~]# postconf -n
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    debug_peer_level = 2
    home_mailbox = Maildir/
    html_directory = no
    inet_interfaces = all
    mail_owner = postfix
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = $myhostname, localhost.localdomain, localhost
    myhostname = mail.crispycode.com
    mynetworks = 127.0.0.0/8 10.123.1.0/24
    myorigin = $mydomain
    newaliases_path = /usr/bin/newaliases.postfix
    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
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
    sample_directory = /usr/share/doc/postfix-2.3.3/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_use_tls = yes
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    unknown_local_recipient_reject_code = 550
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
    virtual_create_maildirsize = yes
    virtual_gid_maps = static:5000
    virtual_mailbox_base = /home/vmail
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-vir
    

    So in short what I need to figure out is why mail to [email protected] gets bounced and why mail to [email protected] is received but with no evidence of the message on the file system.



    Thanks in advance for your help!
     
  2. White

    White Member

    its being delivered to [email protected] because you set your

    myhostname = mail.crispycode.com

    what did you set your server name up as? if it was server1 try this

    mydestination = server1.crispycode.com, localhost, localhost.localdomain

    myhostname = server1.crispycode.com

    track down you directories my Maildir was in the var/www folder for some reason???????????, i have them both in /home/ now and set as this

    virtual_mailbox_base = /home/vmail/
    home_mailbox = /home/vmail/Maildir/
     

Share This Page