====== introduction ====== This document explain how to configure a quick mail system on FreeBSD ====== SSMTP ====== SSMTP is the package which permit the system to send email ===== Installation of the package ===== pkg install ssmtp We receive the following information of the package : sSMTP has been installed successfully. Firstly, edit /etc/mail/mailer.conf to replace sendmail with ssmtp: sendmail /usr/local/sbin/ssmtp send-mail /usr/local/sbin/ssmtp mailq /usr/local/sbin/ssmtp newaliases /usr/local/sbin/ssmtp hoststat /usr/bin/true purgestat /usr/bin/true Hint: in case sSMPT is being installed directly from ports, editing /etc/mail/mailer.conf can be done by running "make replace". Secondly, edit the following files to configure sSMTP: - /usr/local/etc/ssmtp/revaliases - /usr/local/etc/ssmtp/ssmtp.conf At this point sSMTP should be ready to go. -- ===> NOTICE: The ssmtp port currently does not have a maintainer. As a result, it is more likely to have unresolved issues, not be up-to-date, or even be removed in the future. To volunteer to maintain this port, please create an issue at: https://bugs.freebsd.org/bugzilla More information about port maintainership is available at: https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port So we can go to the configuration ==== SSMTP configurations ==== System mailer modification Firstly, edit /etc/mail/mailer.conf to replace sendmail with ssmtp: sendmail /usr/local/sbin/ssmtp send-mail /usr/local/sbin/ssmtp mailq /usr/local/sbin/ssmtp newaliases /usr/local/sbin/ssmtp hoststat /usr/bin/true purgestat /usr/bin/true then tape the following command cd /etc/mail/ make make install ==== revaliases file ==== cat > /usr/local/etc/ssmtp/revaliases << EOF # sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:your_login@your.domain:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. root:admin@limis.fr:ns0.ovh.net:465 EOF ==== ssmtp.conf file ==== cat > /usr/local/etc/ssmtp/ssmtp.conf << EOF # # /etc/ssmtp.conf -- a config file for sSMTP sendmail. # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=fabien.costard@limis.fr # The place where the mail goes. The actual machine name is required # no MX records are consulted. Commonly mailhosts are named mail.domain.com # The example will fit if you are in domain.com and your mailhub is so named. mailhub=ssl0.ovh.net:465 # Example for SMTP port number 2525 # mailhub=mail.your.domain:2525 # Example for SMTP port number 25 (Standard/RFC) # mailhub=mail.your.domain # Example for SSL encrypted connection # mailhub=mail.your.domain:465 # Where will the mail seem to come from? rewriteDomain=limis.fr # The full hostname hostname= # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. #FromLineOverride=YES # Use SSL/TLS to send secure messages to server. UseTLS=YES AuthUser= AuthPass= # Use SSL/TLS certificate to authenticate against smtp host. #UseTLSCert=YES # Use this RSA certificate. #TLSCert=/usr/local/etc/ssmtp/ssmtp.pem # Get enhanced (*really* enhanced) debugging information in the logs # If you want to have debugging of the config file parsing, move this option # to the top of the config file and uncomment #Debug=YES EOF ==== Mail test ==== Tape the following command to test if the mail is currently working echo "contenu" | mail -s "test" fabien.costard@limis.fr If you receive the email, you won ! Next day, you will receive the automatic reports. ==== Add freebsd-update reports ==== Modify the /etc/crontab file to add the following command 0 3 * * * root /usr/sbin/freebsd-update cron