When using a static IP address, one should not need to adjust the default configuration. Set the hostname to the assigned Internet name and Sendmail will do the rest.
When using a dynamically assigned IP address and a dialup
PPP connection to the Internet, one usually has a mailbox on the
ISP's mail server. In this example, the
ISP's domain is example.net
, the user name
is user
, the hostname
is bsd.home
, and
the ISP has allowed relay.example.net
as a mail
relay.
In order to retrieve mail from the ISP's
mailbox, install a retrieval agent from the Ports Collection.
mail/fetchmail is a good choice as it
supports many different protocols. Usually, the
ISP will provide POP.
When using user PPP, email can be
automatically fetched when an Internet connection is established
with the following entry in
/etc/ppp/ppp.linkup
:
MYADDR:
!bg su user -c fetchmail
When using Sendmail to deliver
mail to non-local accounts, configure
Sendmail to process the mail queue as
soon as the Internet connection is established. To do this, add
this line after the above fetchmail
entry in
/etc/ppp/ppp.linkup
:
!bg su user -c "sendmail -q"
In this example, there is an account for
user
on bsd.home
. In the home
directory of user
on
bsd.home
, create a
.fetchmailrc
which contains this
line:
poll example.net protocol pop3 fetchall pass MySecret
This file should not be readable by anyone except
user
as it contains
the password MySecret
.
In order to send mail with the correct
from:
header, configure
Sendmail to use
<user@example.net>
rather than <user@bsd.home>
and to send all mail via
relay.example.net
,
allowing quicker mail transmission.
The following .mc
should
suffice:
VERSIONID(`bsd.home.mc version 1.0')
OSTYPE(bsd4.4)dnl
FEATURE(nouucp)dnl
MAILER(local)dnl
MAILER(smtp)dnl
Cwlocalhost
Cwbsd.home
MASQUERADE_AS(`example.net')dnl
FEATURE(allmasquerade)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(nocanonify)dnl
FEATURE(nodns)dnl
define(`SMART_HOST', `relay.example.net')
Dmbsd.home
define(`confDOMAIN_NAME',`bsd.home')dnl
define(`confDELIVERY_MODE',`deferred')dnl
Refer to the previous section for details of how to convert
this file into the sendmail.cf
format. Do
not forget to restart Sendmail after
updating sendmail.cf
.
本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。
若有 FreeBSD 方面疑問,請先閱讀
FreeBSD 相關文件,如不能解決的話,再洽詢
<questions@FreeBSD.org>。
關於本文件的問題,請洽詢
<doc@FreeBSD.org>。