Contributed by &a.wlloyd;.
E-mail, as simple as the concept sounds, can be extremely complicated. If you plan on doing anything beyond setting up a simple one machine E-mail system, you should buy and refer to a book on Sendmail.
These are the major programs or components of an e-mail exchange.
This is a program like sendmail or delivering it over TCP to your mailhost.
Usually this program is /etc/sysconfig . It is best to leave it on unless you have a specific reason to want it off. Ie: Firewall
You should be aware that sendmail is a potential weak link in a secure site. Some versions of sendmail have known security problems.
sendmail will look up in the DNS to determine the actual host that will receive mail for the destination.
Sendmail will take the message from the local queue and deliver it across the internet to another sendmail on the receivers computer.
Sendmail will also be able to do the reverse. It will accept messages and save them on your local machine.
This program gets the mail from your mailbox and gives it to your browser. If you want to run a POP server on your computer, you will need to do 2 things.
As your FreeBSD system comes "out of the box" you should be able to send e-mail to external hosts. The problem is no mail will be able to get back to your host. This is not a problem if you are willing to make sure you hand edit the automatic reply to address every time you send a message.
It is relatively simple to get another host to receive your e-mail under the same username. You can then pick it up over POP or telnet.
A user account with the SAME USERNAME should exist on both machines. Please use /nonexistant the user will not be allowed to login.
The mailhost that you will be using must be designated the Mail exchange for your host. This must be arranged in DNS (ie BIND, named). Please refer to a Networking book for more information.
You basically need to add these lines in your DNS server.
This feature is used to implement Virtual Hosting.
Example
I have a customer with domain foo.bar and I want all mail for foo.bar to be sent to my machine smtp.smalliap.com. You must make an entry in your DNS server like:
Add myhost.smalliap.com to /etc/sendmail.cw (if you are using FEATURE(use_cw_file)), or add a "Cw myhost.smalliap.com" line to /etc/sendmail.cf.
To actually receive mail on your host, you need to have the MX entry above changed to point to your host. You also move the Cw line above in your sendmail.cf.
This is a Bad Idea if your connection to the internet is not permanent. Mail will bounce.
If you plan on doing anything serious with .
You will probably find that the host is actually in a different domain; for example, if you are in foo.bar.edu and you wish to reach a host called ``mumble'' in the bar.edu domain, you will have to refer to it by the fully-qualified domain name, ``mumble.bar.edu'', instead of just ``mumble''.
Traditionally, this was allowed by BSD BIND resolvers. However the current version of BIND that ships with FreeBSD no longer provides default abbreviations for non-fully qualified domain names other than the domain you are in. So an unqualified host mumble must either be found as mumble.foo.bar.edu, or it will be searched for in the root domain.
This is different from the previous behavior, where the search continued across mumble.bar.edu, and mumble.edu. Have a look at RFC 1535 for why this was considered bad practice, or even a security hole.
As a good workaround, you can place the line
search foo.bar.edu bar.edu
instead of the previous
domain foo.bar.edu
into your /etc/resolv.conf. However, make sure that the search order does not go beyond the ``boundary between local and public administration'', as RFC 1535 calls it.
This is answered in the sendmail FAQ as follows:-
The sendmail FAQ is in /usr/src/usr.sbin/sendmail
and is recommended reading if you want to do any
``tweaking'' of your mail setup.
The sendmail configuration that ships with FreeBSD is
suited for sites that connect directly to the Internet.
Sites that wish to exchange their mail via UUCP must install
another sendmail configuration file.
Tweaking /etc/sendmail.cf manually is considered
something for purists. Sendmail version 8 comes with a
new approach of generating config files via some m4
preprocessing, where the actual hand-crafted configuration
is on a higher abstraction level. You should use the
configuration files under
For UUCP delivery, you are best advised to use the
mailertable feature. This constitutes a database
that sendmail can use to base its routing decision upon.
First, you have to create your .mc file. The
directory /usr/src/usr.sbin/sendmail/cf/cf is the
home of these files. Look around, there are already a few
examples. Assuming you have named your file foo.mc,
all you need to do in order to convert it into a valid
sendmail.cf is:
Once you have this, you need this file called
/etc/mailertable. A typical example of this
gender again:
As a reminder that this file needs to be converted into a
DBM database file before being usable, the command line to
accomplish this is best placed as a comment at the top of
the mailertable. You always have to execute this command
each time you change your mailertable.
Final hint: if you are uncertain whether some particular
mail routing would work, remember the -bt option to
sendmail. It starts sendmail in address test mode;
simply enter ``0 '', followed by the address you wish to
test for the mail routing. The last line tells you the used
internal mail agent, the destination host this agent will be
called with, and the (possibly translated) address. Leave
this mode by typing Control-D.
You want to connect a FreeBSD box on a lan, to the internet. The FreeBSD box will be a mail gateway for the lan. The PPP connection is non-dedicated.
There are at least two way to do this.
The other is to use UUCP.
The key is to get a internet site to provide secondary MX services for your domain.
For example: