Various changes submitted by the original author.
Closes PR# 2372. Reviewed by: The spelling police Submitted by: William Lloyd <wlloyd@mpd.ca>
This commit is contained in:
parent
3f6cd4a8c7
commit
ceefad4d9e
@ -1,4 +1,4 @@
|
||||
<!-- $Id: mail.sgml,v 1.3 1996/12/16 22:13:10 max Exp $
|
||||
<!-- $Id: mail.sgml,v 1.4 1996/11/28 18:09:28 jfieber Exp $
|
||||
The FreeBSD Documentation Project
|
||||
|
||||
<!DOCTYPE linuxdoc PUBLIC "-//FreeBSD//DTD linuxdoc//EN">
|
||||
@ -9,149 +9,152 @@
|
||||
<author> &a.wlloyd;
|
||||
<date> 24 Nov 1996, (c) 1996
|
||||
|
||||
<abstract> This section contains basic information on setting up E-Mail for you FreeBSD box.
|
||||
<abstract> This section contains basic information on setting up Electronic Mail on your new FreeBSD box.
|
||||
</abstract>
|
||||
|
||||
<toc>
|
||||
-->
|
||||
|
||||
<chapt><heading>Electronic Mail<label id="mail"></heading>
|
||||
<sect><heading>Basic Information</heading>
|
||||
|
||||
<p><em>Contributed by &a.wlloyd;.</em>
|
||||
|
||||
<p> 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.
|
||||
<p> Electronic Mail configuration is the subject of many <ref name="System Administration" id="bibliography"> books. If you plan on doing anything beyond setting up one mailhost for your network, you need industrial strength help.
|
||||
|
||||
Some parts of E-Mail configuration are controlled in the Domain Name System (DNS). If you are going to run your own own DNS server check out <bf> <tt> /etc/namedb </tt></bf> and ' <bf><tt>man -k named </tt></bf> ' for more information.
|
||||
|
||||
<sect><heading>Basic Information</heading>
|
||||
|
||||
<sect1><heading>Introduction</heading>
|
||||
<p>
|
||||
These are the major programs or components of an e-mail exchange.
|
||||
<sect2><heading>User program</heading>
|
||||
<p> This is a program like <tt /elm, pine, mail/ , or something more sophisticated like a WWW browser. This program will simply pass off all e-mail transactions to the local mailhost, either by calling <tt>sendmail</tt> or delivering it over TCP to your mailhost.
|
||||
<sect2><heading>Transport Agent - Sendmail</heading>
|
||||
<p> Usually this program is <tt /sendmail or smail/ running in the background. Turn it off or change the command line options in <tt> /etc/sysconfig </tt>. It is best to leave it on unless you have a specific reason to want it off. Ie: Firewall
|
||||
<p>
|
||||
You should be aware that <tt>sendmail</tt> is a potential weak link in a secure site. Some versions of <tt>sendmail</tt> have known security problems.
|
||||
|
||||
<p> <tt> sendmail </tt> will look up in the DNS to determine the actual host that will receive mail for the destination.
|
||||
<p> Sendmail will take the message from the local queue and deliver it across the Internet to another sendmail on the receivers computer.
|
||||
<p> Sendmail will also be able to do the reverse. It will accept messages and save them on your local machine.
|
||||
<sect2><heading>POP Servers</heading>
|
||||
These are the major programs involved in an E-Mail exchange.
|
||||
A <tt/mailhost/ is a server that is responsible for delivering and receiving all email for your host, and possibly your network.
|
||||
|
||||
<sect1><heading>User program</heading>
|
||||
<p> This is a program like <tt /elm, pine, mail/ , or something more sophisticated like a WWW browser. This program will simply pass off all e-mail transactions to the local <tt/mailhost/ , either by calling <tt>sendmail</tt> or delivering it over TCP.
|
||||
|
||||
<sect1><heading>Mailhost Server Daemon</heading>
|
||||
<p> Usually this program is <tt /sendmail or smail/ running in the background. Turn it off or change the command line options in <tt> /etc/sysconfig </tt>. It is best to leave it on, unless you have a specific reason to want it off. Example: You are building a <ref name="Firewall" id="firewalls">.
|
||||
|
||||
<p>You should be aware that <tt>sendmail</tt> is a potential weak link in a secure site. Some versions of <tt>sendmail</tt> have known security problems.
|
||||
|
||||
<p> <tt><bf> sendmail </bf></tt> does two jobs. It looks after delivering and receiving mail.
|
||||
|
||||
If <bf><tt/sendmail/ </bf> needs to delivery mail off your site it will look up in the DNS to determine the actual host that will receive mail for the destination.
|
||||
|
||||
<p> If it is acting as a delivery agent <tt/sendmail/ will take the message from the local queue and deliver it across the Internet to another sendmail on the receivers computer.
|
||||
|
||||
<sect1><heading>DNS - Name Service</heading>
|
||||
<p>The Domain Name System and its daemon <tt/named/ , contain the database mapping hostname to IP address, and hostname to mailhost. The IP address is specified in an "A" record. The "MX" record specifies the mailhost that will receive mail for you. If you do not have a "MX" record mail for your hostname, the mail will be delivered to your host directly.
|
||||
|
||||
Unless you are running your own DNS server, you will not be able to change any information in the DNS yourself. If you are using an Internet Provider, speak to them.
|
||||
|
||||
<sect1><heading>POP Servers</heading>
|
||||
<p> 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.
|
||||
<itemize>
|
||||
<item>Get pop software from the ports or packages collection.
|
||||
<item>Modify <tt>/etc/inetd.conf</> to load POP server.
|
||||
<item>Get pop software from the <url url="../ports/mail.html" name="Ports collection"> that can be found in <tt><bf>/usr/ports </bf></tt>
|
||||
or packages collection. This handbook section has a complete reference on the <ref name="Ports" id="ports"> system.
|
||||
<item>Modify <bf><tt>/etc/inetd.conf</tt></bf> to load the POP server.
|
||||
</itemize>
|
||||
|
||||
The pop program you get will have instructions with it. Read them.
|
||||
|
||||
<sect1><heading>Configuration</heading>
|
||||
<p>
|
||||
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 <tt>reply to address</tt> every time you send a message.
|
||||
<p>
|
||||
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.
|
||||
The pop program will have instructions with it. Read them.
|
||||
|
||||
A user account with the SAME USERNAME should exist on both machines. Please use <tt/adduser/ to do this if needed. If you set the <tt/shell/ to <tt>/nonexistent</tt> the user will not be allowed to login.
|
||||
</sect>
|
||||
|
||||
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.
|
||||
<sect><heading>Configuration</heading>
|
||||
|
||||
<sect1><heading>Basic</heading>
|
||||
<p>
|
||||
As your FreeBSD system comes "out of the box"[TM], you should be able to send E-mail to external hosts as long as you have <bf><tt>/etc/resolv.conf</tt> </bf> setup or are running a name server.
|
||||
If you want to have mail for your host delivered to your specific host,there are two methods:
|
||||
<p>
|
||||
- Run a name server ( <tt><bf>man -k named</></> ) and have your own domain <tt>smallminingco.com </tt>
|
||||
<p>
|
||||
- Get mail delivered to the current DNS name for your host. Ie: <tt>dorm6.ahouse.school.edu </tt>
|
||||
<p>
|
||||
No matter what option you choose, to have mail delivered directly to your host, you must be a full Internet host. You must have a permanent IP address. IE: NO dynamic PPP. If you are behind a firewall, the firewall must be passing on smtp traffic to you. From <bf><tt> /etc/services </tt></bf>
|
||||
<verb>
|
||||
smtp 25/tcp mail #Simple Mail Transfer
|
||||
</verb>
|
||||
If you want to receive mail at your host itself, you must make sure that the DNS MX entry points to your hosts address, or there is no MX entry for your DNS name.
|
||||
|
||||
Try this
|
||||
<verb>
|
||||
newbsdbox# hostname
|
||||
newbsdbox.freebsd.org
|
||||
newbsdbox# host newbsdbox.freebsd.org
|
||||
newbsdbox.freebsd.org has address 204.216.27.xx
|
||||
</verb>
|
||||
|
||||
If that is all that comes out for your machine, mail directory to <tt><bf>root@newbsdbox.freebsd.org </bf></tt> will work no problems.
|
||||
|
||||
If instead, you have this
|
||||
<verb>
|
||||
newbsdbox# host newbsdbox.freebsd.org
|
||||
newbsdbox.FreeBSD.org has address 204.216.27.xx
|
||||
newbsdbox.FreeBSD.org mail is handled (pri=10) by freefall.FreeBSD.org
|
||||
</verb>
|
||||
All mail sent to your host directly will end up on freefall, under the same username.
|
||||
|
||||
This information is setup in your domain name server. This should be the same host that is listed as your primary nameserver in <bf><tt> /etc/resolv.conf</tt></bf>
|
||||
|
||||
The DNS record that carries mail routing information is the Mail eXchange entry. If no MX entry exists, mail will be delivered directly to the host by way of the Address record.
|
||||
|
||||
The MX entry for freefall.freebsd.org at one time.
|
||||
<verb>
|
||||
freefall MX 30 mail.crl.net
|
||||
freefall MX 40 agora.rdrop.com
|
||||
freefall HINFO Pentium FreeBSD
|
||||
freefall MX 10 freefall.FreeBSD.org
|
||||
freefall MX 20 who.cdrom.com
|
||||
freefall A 204.216.27.xx
|
||||
freefall CNAME www.FreeBSD.org
|
||||
</verb>
|
||||
|
||||
freefall has many MX entries. The lowest MX number gets the mail in the end. The others will queue mail temporarily, if freefall is busy or down.
|
||||
|
||||
Alternate MX sites should have separate connections to the Internet, to be most useful. An Internet Provider or other friendly site can provide this service.
|
||||
|
||||
<bf><tt>dig, nslookup, </tt></bf>and<bf><tt> host </tt></bf>are your friends.
|
||||
|
||||
<sect1><heading>Mail for your Domain (Network).<label id="mail:domain"></heading>
|
||||
<p>
|
||||
To setup up a network mailhost, you need to direct the mail from arriving at all the workstations. In other words, you want to hijack all mail for <tt> *.smallminingco.com </tt> and divert it to one machine, your mailhost.
|
||||
|
||||
The network users on their workstations will most likely pick up their mail over POP or telnet.
|
||||
|
||||
A user account with the SAME USERNAME should exist on both machines. Please use <tt/adduser/ to do this as required. If you set the <tt/shell/ to <tt>/nonexistent</tt> the user will not be allowed to login.
|
||||
|
||||
The mailhost that you will be using must be designated the Mail eXchange for each workstation. This must be arranged in DNS (ie BIND, named). Please refer to a Networking book for in-depth information.
|
||||
|
||||
You basically need to add these lines in your DNS server.
|
||||
<verb>
|
||||
myhost.smalliap.com A xxx.xxx.xxx.xxx ; Your ip
|
||||
MX 10 smtp.smalliap.com ; your mailhost
|
||||
</verb>
|
||||
<code>
|
||||
pc24.smallminingco.com A xxx.xxx.xxx.xxx ; Workstation ip
|
||||
MX 10 smtp.smallminingco.com ; Your mailhost
|
||||
</code>
|
||||
|
||||
You cannot do this yourself unless you are running a DNS server. If you do not want to run a DNS server, get somebody else like your Internet Provider to do it.
|
||||
|
||||
This will redirect mail for your host to the MX (Mail eXchange) host. It does not matter what machine the A record points to, the mail will be sent to the MX host.
|
||||
This will redirect mail for the workstation to the Mail eXchange host. It does not matter what machine the A record points to, the mail will be sent to the MX host.
|
||||
<p>
|
||||
This feature is used to implement Virtual Hosting.
|
||||
This feature is used to implement Virtual E-Mail Hosting.
|
||||
<p>Example
|
||||
<p>
|
||||
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:
|
||||
|
||||
<verb>
|
||||
foo.bar MX 10 smtp.smalliap.com ; your mailhost
|
||||
foo.bar MX 10 smtp.smalliap.com ; your mailhost
|
||||
</verb>
|
||||
The A record is not needed if you only want e-mail for the domain.
|
||||
The A record is not needed if you only want E-Mail for the domain. IE: Don't expect <bf><tt>ping foo.bar</tt></bf> to work unless an Address record for <tt>foo.bar</tt> exists as well.
|
||||
|
||||
On the mailhost that actually accepts mail for final delivery to a mailbox, sendmail must be told what hosts it will be accepting mail for.
|
||||
|
||||
<p>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.
|
||||
|
||||
<p>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 <tt>sendmail.cf</tt>.
|
||||
|
||||
<p>Add pc24.smallminingco.com to /etc/sendmail.cw (if you are using FEATURE(use_cw_file)), or add a "Cw myhost.smalliap.com" line to <bf><tt>/etc/sendmail.cf</tt></bf>
|
||||
<p>
|
||||
This is a Bad Idea if your connection to the Internet is not permanent. Mail will bounce.
|
||||
|
||||
<p>
|
||||
If you plan on doing anything serious with <tt/sendmail/ you should install the sendmail source. The source has plenty of documentation with it. You will find information on getting <tt/sendmail/ source from <ref name="UUCP and sendmail" id="sendmailuucp">.
|
||||
</sect>
|
||||
|
||||
<sect><heading>FAQ<label id="mailfaq"></heading>
|
||||
<sect1>
|
||||
<heading>Why do I have to use the FQDN for hosts on my site?</heading>
|
||||
<p>
|
||||
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''.
|
||||
<p>
|
||||
Traditionally, this was allowed by BSD BIND resolvers. However
|
||||
the current version of <em>BIND</em> 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 <tt>mumble</tt> must either be found
|
||||
as <tt>mumble.foo.bar.edu</tt>, or it will be searched for
|
||||
in the root domain.
|
||||
<p>
|
||||
This is different from the previous behavior, where the
|
||||
search continued across <tt>mumble.bar.edu</tt>, and
|
||||
<tt>mumble.edu</tt>. Have a look at RFC 1535 for why this
|
||||
was considered bad practice, or even a security hole.
|
||||
<p>
|
||||
As a good workaround, you can place the line
|
||||
<p><tt>
|
||||
search foo.bar.edu bar.edu
|
||||
</tt><p>
|
||||
instead of the previous
|
||||
|
||||
<p><tt>
|
||||
domain foo.bar.edu
|
||||
</tt><p>
|
||||
into your <tt>/etc/resolv.conf</tt>. However, make sure
|
||||
that the search order does not go beyond the ``boundary
|
||||
between local and public administration'', as RFC 1535
|
||||
calls it.
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1><heading>Sendmail says ``mail loops back to myself''</heading>
|
||||
<p>
|
||||
This is answered in the sendmail FAQ as follows:-
|
||||
<verb>
|
||||
* I am getting "Local configuration error" messages, such as:
|
||||
|
||||
553 relay.domain.net config error: mail loops back to myself
|
||||
554 <user@domain.net>... Local configuration error
|
||||
|
||||
How can I solve this problem?
|
||||
|
||||
You have asked mail to the domain (e.g., domain.net) to be
|
||||
forwarded to a specific host (in this case, relay.domain.net)
|
||||
by using an MX record, but the relay machine does not recognize
|
||||
itself as domain.net. Add domain.net to /etc/sendmail.cw
|
||||
(if you are using FEATURE(use_cw_file)) or add "Cw domain.net"
|
||||
to /etc/sendmail.cf.
|
||||
</verb>
|
||||
<p>
|
||||
The sendmail FAQ is in <tt>/usr/src/usr.sbin/sendmail</tt>
|
||||
and is recommended reading if you want to do any
|
||||
``tweaking'' of your mail setup.
|
||||
|
||||
<sect1>
|
||||
<heading>How do I use sendmail for mail delivery with UUCP?<label id="sendmailuucp"></heading>
|
||||
If you plan on doing anything serious with <tt/sendmail/ you should install the sendmail source. The source has plenty of documentation with it. You will find information on getting <tt/sendmail/ source from <ref name="the UUCP information" id="sendmailuucp">.
|
||||
|
||||
|
||||
<sect1>
|
||||
<heading> Setting up UUCP.<label id="sendmailuucp"></heading>
|
||||
<p><em>Stolen from the FAQ.</em>
|
||||
<p>
|
||||
The sendmail configuration that ships with FreeBSD is
|
||||
suited for sites that connect directly to the Internet.
|
||||
@ -294,8 +297,76 @@ domain foo.bar.edu
|
||||
> ^D
|
||||
j@uriah 192%
|
||||
</verb>
|
||||
</sect>
|
||||
|
||||
<sect1><heading>How can I do e-mail with a dialup PPP host</heading>
|
||||
<sect><heading>FAQ<label id="mailfaq"></heading>
|
||||
|
||||
<p><em>Migration from FAQ.</em>
|
||||
|
||||
<sect1>
|
||||
|
||||
<heading>Why do I have to use the FQDN for hosts on my site?</heading>
|
||||
<p>
|
||||
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''.
|
||||
<p>
|
||||
Traditionally, this was allowed by BSD BIND resolvers. However
|
||||
the current version of <em>BIND</em> 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 <tt>mumble</tt> must either be found
|
||||
as <tt>mumble.foo.bar.edu</tt>, or it will be searched for
|
||||
in the root domain.
|
||||
<p>
|
||||
This is different from the previous behavior, where the
|
||||
search continued across <tt>mumble.bar.edu</tt>, and
|
||||
<tt>mumble.edu</tt>. Have a look at RFC 1535 for why this
|
||||
was considered bad practice, or even a security hole.
|
||||
<p>
|
||||
As a good workaround, you can place the line
|
||||
<p><tt>
|
||||
search foo.bar.edu bar.edu
|
||||
</tt><p>
|
||||
instead of the previous
|
||||
|
||||
<p><tt>
|
||||
domain foo.bar.edu
|
||||
</tt><p>
|
||||
into your <tt>/etc/resolv.conf</tt>. However, make sure
|
||||
that the search order does not go beyond the ``boundary
|
||||
between local and public administration'', as RFC 1535
|
||||
calls it.
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1><heading>Sendmail says ``mail loops back to myself''</heading>
|
||||
<p>
|
||||
This is answered in the sendmail FAQ as follows:-
|
||||
<verb>
|
||||
* I am getting "Local configuration error" messages, such as:
|
||||
|
||||
553 relay.domain.net config error: mail loops back to myself
|
||||
554 <user@domain.net>... Local configuration error
|
||||
|
||||
How can I solve this problem?
|
||||
|
||||
You have asked mail to the domain (e.g., domain.net) to be
|
||||
forwarded to a specific host (in this case, relay.domain.net)
|
||||
by using an MX record, but the relay machine does not recognize
|
||||
itself as domain.net. Add domain.net to /etc/sendmail.cw
|
||||
(if you are using FEATURE(use_cw_file)) or add "Cw domain.net"
|
||||
to /etc/sendmail.cf.
|
||||
</verb>
|
||||
<p>
|
||||
The sendmail FAQ is in <tt>/usr/src/usr.sbin/sendmail</tt>
|
||||
and is recommended reading if you want to do any
|
||||
``tweaking'' of your mail setup.
|
||||
|
||||
|
||||
<sect1><heading>How can I do E-Mail with a dialup PPP host?</heading>
|
||||
<p>
|
||||
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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user