Setup mailaccount

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

  1. mike

    mike New Member

    Hi,

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

    Now how do I create a mailaccount using courier imap?

    Michael
     
  2. falko

    falko Super Moderator

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

    Code:
    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:

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

    Code:
    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.:

    Code:
    localhost
    your.server.name
    localhost.your.server.name
    example.com
    yourdomain.com
    /etc/postfix/virtusertable looks like this:

    Code:
    info@yourdomain.com  sample_user
    thomas@example.com  sample_user
    webmaster@yourdomain.com  sample_user
    Emails for info@yourdomain.com, thomas@example.com and webmaster@yourdomain.com will now arrive in the mailbox of sample_user.

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

    Code:
    postmap /etc/postfix/virtusertable
    Now restart Postfix:

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

    mike New Member

    Thanks Falko! It is working... :)

    Michael
     
  4. johnnynine

    johnnynine New Member

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

    falko Super Moderator

    /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

    etc/postfix/local-host-names

    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

    Thanks
    Happy
     
  8. falko

    falko Super Moderator

    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

  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
    localhost
    your.server.name
    localhost.your.server.name
    your.domain

    after entering the info above

    I go to write the info and get the following error

    "etc/postfix/local-host-names"
    "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

    Thanks
    Happy
     
  13. falko

    falko Super Moderator

    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

    Thanks
    Happy
     
  15. Happy

    Happy New Member

    creating email accounts

    Ok I orginally created the users mailboxes in webmin

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

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

    Happy
     
  16. falko

    falko Super Moderator

    What's the exact error message? What's in /etc/postfix/main.cf?
     
  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: "sample.net"
    postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: "sample.net"
    postmap: warning: /etc/postfix/virtusertable.db: duplicate entry: "sample.net"
    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
    /etc/postfix/main.cf

    Thanks
    Happy
     
    Last edited: Aug 31, 2007
  18. falko

    falko Super Moderator

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

    Happy New Member

    output

    root@mail:~# vi /etc/postfix/main.cf
    # See /usr/share/postfix/main.cf.dist 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 = mail.sample.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = /etc/postfix/local-host-names
    relayhost =

    mynetworks = 127.0.0.0/8
    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

    Happy
     
  20. falko

    falko Super Moderator

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

Share This Page