Setup mailaccount

Discussion in 'HOWTO-Related Questions' started by mike, Apr 19, 2005.

  1. mike

    mike New Member


    I have followed the SuSE 9.2 server "The Perfect Setup".

    Now how do I create a mailaccount using courier imap?

  2. falko

    falko Super Moderator Howtoforge Staff

    First you have to tell Postfix to deliver emails to a user's Maildir:

    postconf -e 'home_mailbox = Maildir/'
    postconf -e 'mailbox_command ='
    /etc/init.d/postfix restart
    Then you have to create a system user and a password:

    useradd -d /home/sample_user -g users sample_user
    passwd sample_user
    Then run

    postconf -e 'virtual_maps = hash:/etc/postfix/virtusertable'
    postconf -e 'mydestination = /etc/postfix/local-host-names'
    /etc/postfix/local-host-names should contain all domains that you want to accept emails for, e.g.:

    /etc/postfix/virtusertable looks like this:

    [email protected]  sample_user
    [email protected]  sample_user
    [email protected]  sample_user
    Emails for [email protected], [email protected] and [email protected] will now arrive in the mailbox of sample_user.

    Everytime you change /etc/postfix/virtusertable you have to run the following command:

    postmap /etc/postfix/virtusertable
    Now restart Postfix:

    /etc/init.d/postfix restart
    and you're done! :)
  3. mike

    mike New Member

    Thanks Falko! It is working... :)

  4. johnnynine

    johnnynine New Member

    What's the difference between using /etc/postfix/virtusertable and /etc/aliases?
  5. falko

    falko Super Moderator Howtoforge Staff

    /etc/aliases maps the mails for existing system users to another system user. virtusertable defines the email addresses that belong to a system user.
  6. johnnynine

    johnnynine New Member

    I have my /etc/aliases file mapping non-existing system users to a system user and it works fine, so I don't quite understand?
  7. Happy

    Happy New Member

    postfix config


    the above file contains no info and when I try and open it says new file. So do I create files that do not exist. as I ran the command prior to the above. I used webmin to add users. Again I am using just local or system users no virtual users

  8. falko

    falko Super Moderator Howtoforge Staff

    Yes, you must create that file.
  9. johnnynine

    johnnynine New Member

    Ok, I reread this and it makes sense... too many late night linux installs.
  10. Happy

    Happy New Member

    Last edited: Aug 31, 2007
  11. falko

    falko Super Moderator Howtoforge Staff

  12. Happy

    Happy New Member

    error when trying to create the following file

    I am trying to create the folloing file

    vi /etc/postfix/local-host-names

    after entering the info above

    I go to write the info and get the following error

    "etc/postfix/local-host-names" E212: Can't open file for writing
    Hit ENTER or type command to continue
    Get a 127 Shell error as well
    Any ideas on why I can not create this file

  13. falko

    falko Super Moderator Howtoforge Staff

    Make sure you use /etc/postfix/local-host-names and not etc/postfix/local-host-names.
  14. Happy

    Happy New Member

    error when trying to create the following file

    The . was the problem-not sure how it got in there

  15. Happy

    Happy New Member

    creating email accounts

    Ok I orginally created the users mailboxes in webmin

    and then created them in
    when I ran /etc/init.d/postfix restart
    I got a error/warning saying duplicate -
    however the users remained in

    Should I expect any issue
    If not then I will begin testing as I am done except for doing some Spam catching/filtering

  16. falko

    falko Super Moderator Howtoforge Staff

    What's the exact error message? What's in /etc/postfix/
  17. Happy

    Happy New Member

    error message

    Again the users were created in webmin
    Here is the error message I got

    root@mail:~# postmap /etc/postfix/virtusertable
    postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: ""
    postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: ""
    postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: ""
    is this not needed since I created the users in webmin or should I delete all users out of webmin and then create them manually?

    I got the above waring/error when I added another user (I created the user in webmin first) and then added to the virtusertable
    The following file exist but nothing is in it

    Last edited: Aug 31, 2007
  18. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/virtusertable? What's the output of
    cat /etc/postfix/
  19. Happy

    Happy New Member


    root@mail:~# vi /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 (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

    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${queue_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 = /etc/postfix/local-host-names
    relayhost =

    mynetworks =
    mailbox_command =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = 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
    smtp_tls_note_starttls_offer = yes
    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/
    virtual_maps = hash:/etc/postfix/virtusertable

  20. falko

    falko Super Moderator Howtoforge Staff

    Do you have duplicates in /etc/postfix/virtusertable?

Share This Page