Mail delivery problem (Postfix/Courier)

Discussion in 'Server Operation' started by sebdah, Sep 3, 2006.

  1. sebdah

    sebdah New Member

    Hi!
    I've installed Postfix and Courier as described in this howto. I can send mail via this server from an account, but I can't receive messages (or the server doesn't accept email?).

    When sending a mail to [email protected] I get this in return (in a mailer deamon mail):

    Code:
    PERM_FAILURE: SMTP Error (state 9): 550 <[email protected]>: Recipient address rejected: User unknown in relay recipient table
    What might be the problem?

    Have a nice day and thanks in advance.
    Sebastian
     
  2. drks

    drks New Member HowtoForge Supporter

    It looks like the user doesn't exist, or Postfix is not configured for that domain. Please make sure of the following:

    1) The domain must be listed in the 'mydestination' variable in /etc/postfix/main.cf. This tells postfix that it is to receive mail for 'domain.com' (whatever your actual domain is).

    2) The user must exist, or there must be a virtual map to the real user. For example, if the user is 'me' then their should be a system user called 'me' (in /etc/passwd). My default, postfix will send any mail for '[email protected]' to 'me@localhost'. However, if the 'me' user does not exist at the system level, then there needs to be a virtual map alias. This is usually handled by the "virtual_maps" setting in '/etc/postfix/main.cf' such as:

    Code:
    virtual_maps = hash:/etc/postfix/virtual
    

    This says that '/etc/postfix/virtual' contains a list of virtual alias maps. Within this file, I would have:

    Code:
    [email protected]        realuser
    

    Where 'realuser' is the system user (in /etc/passwd). If you are modifying this file, you will need to re-create the hash/map file:

    Code:
    postmap /etc/postfix/virtual
    

    And maybe reload the config:

    Code:
    postfix reload
    

    This should allow you to accept mail for '[email protected]' (assuming that you actually set it up for a proper 'user' at a real 'domain'.
     
  3. sebdah

    sebdah New Member

    Hi and thanks for your reply!

    I have created the system user, as well as the folders /home/user/Maildir and the subdirs tmp, new and cur.

    Now I tried to follow your steps for virtual users. But the problem is still the same. Is there any way for me to check that the mail is possible for Postfix to send to me@localhost?

    Here is my main.cf:

    Code:
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    myhostname = domain.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = domain.com, localhost
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    home_mailbox = Maildir/
    mailbox_command =
    virtual_maps = hash:/etc/postfix/virtual-users
    
    Thanks!
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/virtual-users? What's the output of
    Code:
    ls -l /etc/postfix
    ? You should also add localhost.localdomain to the mydestination line in main.cf.
     
  5. sebdah

    sebdah New Member

    Hi!
    This is the output of ls -l /etc/postfix

    Code:
    -rw-r--r--  1 root root   318 Sep  3 13:54 dynamicmaps.cf
    -rw-r--r--  1 root root  1520 Sep  3 21:22 main.cf
    -rw-r--r--  1 root root  4011 Sep  3 13:54 master.cf
    -rwxr-xr-x  1 root root 22018 Feb 24  2006 post-install
    -rw-r--r--  1 root root 17562 Feb 24  2006 postfix-files
    -rwxr-xr-x  1 root root  6836 Feb 24  2006 postfix-script
    -rw-------  1 root root  1024 Sep  4 11:15 prng_exch
    drwxr-xr-x  2 root root  4096 Sep  3 13:56 sasl
    drwxr-xr-x  2 root root  4096 Sep  3 14:00 ssl
    -rwxrwxrwx  1 root root    48 Sep  4 11:15 virtual-users
    -rw-r--r--  1 root root 49152 Sep  4 11:15 virtual-users.db
    
    virtual-users is chmoded 777 just in case =).

    I added localhost.mydomain.com where mydomain.com is the output of cat /etc/hostname.
     
  6. sebdah

    sebdah New Member

    Any ideas?
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Please also add localhost.localdomain (don't replace localdomain!) and all the other domain that your server should receive mails for to mydestination in /etc/postfix/main.cf. Then restart Postfix.
     
  8. ddrager

    ddrager New Member

    I am not an expert but I have had experience tweaking the allow relay users in Postfix. From Postfix's page:

    It then goes on to say:

    I would suggest adding the following line to your main.cf under the alias_maps paramater:

    Code:
    local_recipient_maps = proxy:unix:passwd.byname $alias_maps
    Let me know how it goes.
     

Share This Page