Install Postfix and Dovecot 1. Using Pkg: $sudo pkg install postfix dovecot Answer yes if prompted with (by pressing y then enter) Would you like to activate Postfix in /etc/mail/mailer.conf [n]? 2. Enable in /etc/rc.conf and disable Sendmail $sudo ee /etc/rc.conf postfix_enable=YES dovecot_enable=YES sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" 3. Stop Sendmail (it may be running) $sudo service sendmail stop 4. Ensure you have a working MX record $dig xxxx.afnog.guru mx Where XXX is your zone name 5. Edit main.cf $cd /usr/local/etc/postfix $sudo mv main.cf main.cf.orig $sudo ee main.cf Add the following and replace XXX where necessary ############################# queue_directory = /var/spool/postfix command_directory = /usr/local/sbin daemon_directory = /usr/local/libexec/postfix data_directory = /var/db/postfix mail_owner = postfix myhostname = pcXX.sse.ws.afnog.org inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, mail.XXXX.afnog.guru, XXX.afnog.guru unknown_local_recipient_reject_code = 550 mynetworks_style = subnet mynetworks = 127.0.0.0/8 196.200.208.0/20 [::1]/128 [2001:43f8:220::]/48 #relay_domains = $mydestination if this server was relaying for others #relayhost = $mydomain #relayhost = [an.ip.add.ress] smtpd_banner = $myhostname HAHAHA Server #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/local/sbin/sendmail newaliases_path = /usr/local/bin/newaliases mailq_path = /usr/local/bin/mailq setgid_group = maildrop manpage_directory = /usr/local/man sample_directory = /usr/local/etc/postfix readme_directory = /usr/local/share/doc/postfix inet_protocols = ipv4 ipv6 ########################## 6. Edit the aliases file to look like below $sudo ee /etc/aliases ### #root: postmaster root: afnog nagios: afnog #### Save and exit. $sudo newaliases 7. Start Postfix $ sudo service postfix start 8. Turn of the firewall for now $service pf stop 9. Send email to thew afnog user from anywhere (e.g. use gmail or your company/university email) 10. Check the email $sudo tail -f /var/mail/afnog