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 such as send-pr(1). 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:
root=yourrealemail@example.com 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, including the outgoing mail service. See Section 28.4.2 for details.
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.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.