How to install email server and access from guest PC

Discussion in 'Linux' started by vidyarathne, Feb 19, 2018.

  1. vidyarathne

    vidyarathne MDL Junior Member

    Jan 23, 2013
    Hello, my university lecturer ask me to install Linux version to virtualbox and install email server.after that create 2 user (mail) accounts and send mails between them.and mail server should be accessible through guest operating system. (windows).

    I tried to install postfix,dovecot and squirrelmail.but i'm unable to configure it properly.I'm new to please help me to configure it.

    P.S : i'm using ubuntu 16.04.3 LTS (Desktop) and virtualbox.
  2. fabre gastro

    fabre gastro MDL Junior Member

    May 29, 2018
    run every command as su or sudo with admin rights.

    sudo su

    apt-get install exim4-daemon-heavy
    dpkg-reconfigure exim4-config

    (supply the domain name and host/server ip address and port i will assume 25, 993,995)

    cat /dev/null > /etc/default/exim4

    cat >> /etc/default/exim4 << "EOF"
    # /etc/default/exim4

    # 'combined' - one daemon running queue and listening on SMTP port
    # 'no' - no daemon running the queue
    # 'separate' - two separate daemons
    # 'ppp' - only run queue with /etc/ppp/ip-up.d/exim4.
    # 'nodaemon' - no daemon is started at all.
    # 'queueonly' - only a queue running daemon is started, no SMTP listener.
    # setting this to 'no' will also disable queueruns from /etc/ppp/ip-up.d/exim4
    # how often should we run the queue
    # options common to quez-runner and listening daemon
    # more options for the daemon/process running the queue (applies to the one
    # started in /etc/ppp/ip-up.d/exim4, too.
    # special flags given to exim directly after the -q. See exim(8)
    # Options for the SMTP listener daemon. By default, it is listening on
    # port 25 only. To listen on more ports, it is recommended to use
    # -oX 25:587:10025 -oP /var/run/exim4/

    # Exim4 will now listen on ports 465 (ssmtp/smtps), 993 (imaps), 995 (pop3s)
    # If needed it can also listen non-ssl, pop port (110) and also imap (220)
    #SMTPLISTENEROPTIONS='-oX 110:220:465:993:995 -oP /var/run/exim4/'
    #SMTPLISTENEROPTIONS='-oX 110:220:993:995 -oP /var/run/exim4/'
    SMTPLISTENEROPTIONS='-oX 25:993:995 -oP /var/run/exim4/'

    systemctl enable exim4.service && systemctl start exim4.service

    /usr/sbin/groupadd -f -g 1010 test1
    /usr/sbin/groupadd -f -g 1011 test2
    /usr/sbin/useradd -m --shell /bin/bash --uid 1010 --gid 1010 --comment "Testing E-Mail Server User 1" test1
    /usr/sbin/useradd -m --shell /bin/bash --uid 1011 --gid 1011 --comment "Testing E-Mail Server User 2" test2

    cat >> /etc/alias << "EOF"

    i skipped the iptables section as its extremely complex.

    fire up your mail client like thunderbird or mutt.
    i will go with thunderbird.
    click on account settings -> add other account -> unix mail spool ->
    click on account settings -> add other account -> unix mail spool ->
    for both outgoing mail server is localhost
    restart thunderbird.
    and now you can spam the s.h.i.t. out of your own self inside the vm....
    happy spamming.
    tips: make sure both the vm can ping each other.

    you can also repeat vm1 in vm2 and vm2 in vm1 ;-)
    p.s. hope i am not too late ...... meh bit it may still help others. i will post a little complex iptables later. but for now its w/o iptables.