Download:    pkg exim-4.91.pkg    pkg DBD-mysql-4.042.pkg    pkg libspf2.rb.zip

Move libspf2.rb to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

$ brew install libspf2

  Via Terminal:   (create user and password in mysql that will be used for exim and some other modules)

mysql -h -u root -p
CREATE USER 'email_users'@'localhost' IDENTIFIED BY 'CHANGE';
GRANT ALL ON ecm3.* TO 'email_users'@'localhost';
In order to run Exim and Dovecot you will need SSL certificates. If you dont have one, you can generate a self signed.

Also run the following code in your terminal to create an encrypted prime number for a more secure exim.

$ login root
$ mkdir -p /private/etc/certificates
$ openssl dhparam -out /private/etc/certificates/dhparam.pem 2048

$ login root
$ nano /usr/local/exim/configure

primary_hostname = example.com
hide mysql_servers = localhost::(/tmp/mysql.sock)/ecm3/email_users/CHANGE

tls_certificate = /private/etc/certificates/example.com.crt
tls_privatekey = /private/etc/certificates/example.com.key

$ sudo launchctl load /Library/LaunchDaemons/net.captainnet.exim.plist
$ sudo launchctl load /Library/LaunchDaemons/net.captainnet.exim-logrotate.plist


            Download:     pkg dovecot-2.3.1.pkg

     EDIT:$ login root
$ nano /usr/local/dovecot/etc/dovecot/dovecot-sql.conf.ext

connect = host=/tmp/mysql.sock dbname=ecm3 user=email_users password=CHANGE

     EDIT:$ nano /usr/local/dovecot/etc/dovecot/conf.d/10-ssl.conf

ssl_cert = </etc/certificates/DOMAIN.COM.crt
ssl_key = </etc/certificates/DOMAIN.COM.key

     EDIT:$ nano /usr/local/dovecot/etc/dovecot/conf.d/15-lda.conf

postmaster_address = postmaster@DOMAIN.COM

$ sudo launchctl load /Library/LaunchDaemons/net.captainnet.dovecot.plist 


            Download:     pkg SpamAssassin-3.4.1.pkg

$ login root
$ cpan
$ install DBI
$ install IO::Socket::IP
$ install Net::Patricia
$ install Net::DNS

$ echo 'export PATH=/usr/local/spamassassin/bin:$PATH' >> ~/.bash_profile
$ echo 'export MANPATH=/usr/local/spamassassin/share/man:$MANPATH' >> ~/.bash_profile
$ echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

    EDIT:$ open -e /usr/local/spamassassin/etc/mail/spamassassin/sql.cf
Replace the word CHANGE with your password for email_users at three differrent places.

$ sudo launchctl load /Library/LaunchDaemons/net.captainnet.spamassassin.plist
    EDIT:$ login root
$ nano /private/etc/syslog.conf

drop in the following line into syslog configuration file:

mail.* /var/log/mail.log

Reboot computer.


            Download:     pkg clamav-start.pkg

$ brew install clamav

$ sudo chown clamav:admin /usr/local/opt/clamav/share/clamav

sudo launchctl load /Library/LaunchDaemons/net.captainnet.clamd.plist
sudo launchctl load /Library/LaunchDaemons/net.captainnet.freshclam.plist


            Download:     pkg roundcubemail.zip

Move it to:      /usr/local/share   

Create a database with the name 'roundcube'. The sql file is located at /usr/local/share/roundcubemail/SQL/mysql.initial.sql

In the following three instances use your root mysql password.

     EDIT:$ open -e /usr/local/share/roundcubemail/config/config.inc.php

$config['db_dsnw'] = 'mysql://root:CHANGE@localhost/roundcube';

     EDIT:$ open -e /usr/local/share/roundcubemail/plugins/password/config.inc.php

$config['password_db_dsn'] = 'mysql://root:CHANGE@localhost/ecm3';

     EDIT:$ open -e /usr/local/share/roundcubemail/plugins/SAUserPrefs/config.inc.php

$config['sauserprefs_db_dsnw'] = 'mysql://root:CHANGE@localhost/ecm3';


      EDIT:$ open -e /usr/local/etc/httpd/httpd.conf

Alias /roundcubemail /usr/local/share/roundcubemail

$ sudo apachectl -k restart