There are many instances where you may only want to send mail through a relay. Some examples are:
Your computer is a desktop machine, but you want to use programs from the command line that send mail. To do so, you should use your ISP's mail relay.
The computer is a server that does not handle mail locally, but needs to pass off all mail to a relay for processing.
Just about any MTA is capable of filling this particular niche. Unfortunately, it can be very difficult to properly configure a full-featured MTA just to handle offloading mail. Programs such as sendmail and postfix are largely overkill for this use.
Additionally, if you are using a typical Internet access service, your agreement may forbid you from running a ``mail server''.
The easiest way to fulfill those needs is to install the mail/ssmtp port. Execute the following commands as root:
# cd /usr/ports/mail/ssmtp # make install replace clean
Once installed, mail/ssmtp can be configured with a four-line file located at /usr/local/etc/ssmtp/ssmtp.conf:
firstname.lastname@example.org mailhub=mail.example.com rewriteDomain=example.com hostname=_HOSTNAME_
Make sure you use your real email address for root. Enter your ISP's outgoing mail relay in place of mail.example.com (some ISPs call this the ``outgoing mail server'' or ``SMTP server'').
Make sure you disable sendmail by setting sendmail_enable="NONE" in /etc/rc.conf.
mail/ssmtp has some other options available. See the example configuration file in /usr/local/etc/ssmtp or the manual page of ssmtp for some examples and more information.
Setting up ssmtp in this manner will allow any software on your computer that needs to send mail to function properly, while not violating your ISP's usage policy or allowing your computer to be hijacked for spamming.
Contact the Documentation mailing list for comments, suggestions and questions about this document.