How to install email server and access from guest PC

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

  1. vidyarathne

    vidyarathne MDL Novice

    Jan 23, 2013
    40
    4
    0
    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 linux.so 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
    72
    23
    0
    VM1.
    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
    EX4DEF_VERSION=''

    # '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
    QUEUERUNNER='combined'
    # how often should we run the queue
    QUEUEINTERVAL='30m'
    # options common to quez-runner and listening daemon
    COMMONOPTIONS=''
    # more options for the daemon/process running the queue (applies to the one
    # started in /etc/ppp/ip-up.d/exim4, too.
    QUEUERUNNEROPTIONS=''
    # special flags given to exim directly after the -q. See exim(8)
    QFLAGS=''
    # 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/exim.pid
    ##SMTPLISTENEROPTIONS=''

    # 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/exim.pid'
    #SMTPLISTENEROPTIONS='-oX 110:220:993:995 -oP /var/run/exim4/exim.pid'
    SMTPLISTENEROPTIONS='-oX 25:993:995 -oP /var/run/exim4/exim.pid'
    EOF

    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"
    test1:root
    test2:root
    EOF

    i skipped the iptables section as its extremely complex.

    VM2
    fire up your mail client like thunderbird or mutt.
    i will go with thunderbird.
    click on account settings -> add other account -> unix mail spool -> test1@ip.add.re.ss.of.VM1
    click on account settings -> add other account -> unix mail spool -> test2@ip.add.re.ss.of.VM1
    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.