The following sections answer some of the more freqently asked questions regarding Linux and Electronic mail management.
Look at the w class in sendmail.cf to ensure that both domain names are in it. (it either should be in the file specified by Fw/file/name (usually /etc/sendmail.cw), or in the Cwhostnames ... line in the /etc/sendmail.cf file)
Check http://www.sendmail.org/virtual-hosting.html for more information.
Enable:
O HoldExpensive=True
At the top of sendmail.cf, and add the ``e'' flag to the
``F='' section of each of the outbound mailers (smtp, smtp8, esmtp, relay),
e.g.:
Msmtp, P=[IPC], F=mDFMuXe, S=11/31, R=21, E=\r\n, L=990,
T=DNS/RFC822/SMTP,
A=IPC $h
Also, change the command which starts the sendmail daemon so that it doesn't
contain a ``-q15m'' switch (or similar). (It's been advised that you should
run sendmail with -bd -os switches See the sendmail documentation for more
information). This way, you will be able to flush your mailq once you are
connected to the network:
sendmail -q
That is a rather more compilcated subject to be covered in a single FAQ. But we will try to give a fairly good idea how this thing should be done, and point you to places where you could gain additional information.
Note: In this section I refer generally to sendmail version 8.8.8. - the one, which I use on the moment. Things with other versions might be slightly different, but the idea should be the similar.
First thing I would advice you here is to get sendmail source, since we will need to generate configuration file using tools/templates, included in it. The best place for it would be (of course): ftp://ftp.sendmail.org the primary sendmail ftp site.You could also use rpm package from redhat site.( ftp://ftp.redhat.com).
I assume that you have already compiled and installed sendmail binaries.
Now you need to generate sendmail.cf file. For this we will use one of
templates located in ....sendmail-X.X.X/cf/cf/ directory (X.X.X here is
usually your sendmail version). You will need one which is named
uucpproto.mc. Copy it to some other file (for ex. myuucp.mc).
Generally, You will need only to make few changes here. Set the type
of your operating system. (Linux right?:-)), and define SMART_HOST - the
machine, which you will relay all your mail to. Load this file (your
copy) into your favorite editor and change following:
And you are nearly done. Your mc file should look like this:
OSTYPE(linux)dnl
FEATURE(nodns)dnl
MAILER(local)dnl
MAILER(smtp)dnl
MAILER(uucp)dnl
define(`SMART_HOST',uucp:YOUR_UUCP_ISP)dnl
Now create your sendmail.cf file:
m4 ../m4/cf.m4 myuucp.mc > /etc/sendmail.cf
Now what you need to do is to force sendmail not to lookup hostnames via DNS. Based on my own experience I figured out that having FEATURE(nodns)dnl is not enough. For this you will need to create file /etc/service.switch containing following:
hosts files
aliases files
Now if you have your uucp systems already all configured properly (do
checks with uuchk.) you may start sendmail daemon: /usr/sbin/sendmail
-bd -q 15m or the similar.
Try to send a couple of test messages and I see if it puts them into uucp directory of YOUR_UUCP_ISP machine. If not,:) well, go back and investigate what's wrong. (log files could be of great help).
Here we got things nearly all done. All we need to do is to configure your system so it will exchange email with your ISP every XX amount of time. There are actually few ways, but I would prefer crontab: the simplest way would be to add line like this :
0,15,30,45 * * * * /usr/sbin/uucico -S YOUR_UUCP_ISP
in your crontab. (use ``crontab -e -u uucp'' logged in as root).
This will dial up your UUCP party every 15 minutes. (check man for crontab
for variations).
The thing we described here does not pretend to be complete description of how to get the things working, so you will need to check additional information. Here we bring some sources you may find interesting:
Assuming your UUCP is configured, the things are fairly simple. First you will need to set up DNS entries for your domains, which you gave to your UUCP connected parties with the higher MX score pointing to your machine.
Then reconfigure your sendmail to use mailertable and
have uucp mailer (i.g prototype should
have FEATURE(mailertable)dnl and mailer(uucp)dnlin it).
For each uucp system create:
youruucpdomain.yourdomain.com uucp-dom:youruucpdomain
Now rebuild your mailertable (assuming you have it in /etc/mailertable and type is hash, it should be something like:
makemap hash mailertable < mailertable
), And things should work just fine.
To complete this task you need:
FEATURE(use_cw_file)
virtualdomain.com
Actually, this step may not strictly be necessary. If
virtualdomain.com resolves to an IP address which is assigned to the
server, sendmail will answer mail for that domain even if it isn't in
the sendmail.cw file (unless you're running >= 8.8.8 and have disabled
that feature), but it's best to add it just to be sure.
FEATURE(virtusertable, btree /etc/virt_mail)
In this example I use a btree database file. dbm and hash may also be
available on your system.
someone@virtualdomain.com local_user_1
@virtualdomain.com local_user_2
The first line maps someone@virtualdomain.com to local_user_1. The
second line directs all mail for virtualdomain.com (with the exception
of someone@ to local_user_2. Note that unlike /etc/aliases, there are
no colons after the LHS.
To prevent other users on your system from getting mail to virtualdomain.com, I'd suggest that you always install a catch-all address like the second line above. Otherwise, people with no connection to virtualdomain.com could start receiving mail for that domain if they have a pretty common user name.
makemap btree /etc/virt_mail < /etc/_virtmail
m4 my-file.mc > /etc/sendmail.cf
*Note* that anytime you create a new .cf file, of make any changes to
your .cw file, you *must* stop and restart sendmail. If you make a
change to your database file, you do not need to stop sendmail.
NOTE:with lattest versions of sendmail you will
need to include cf.m4 file from within the command line:
m4 path/to/cf.m4 my-file.mc > /etc/sendmail.cf
@ IN MX 10 your.mail.server.com
and send a signal kill -1 to named on your DNS server if you have to
make this change.
dig virtualdomain.com mx
telnet your.mail.server.com smtp
expn someone@virtualdomain.com
expn blahbalh@virtualdomain.com
quit
The first expn command tests the first line of our virtual user table,
and should return local_user_1. The second line should return
local_user_2.
Delete the /var/tmp/.pop/username file. Better still, run the
rm_stale.sh script (from the pop3d distribution) via cron to
delete stale temporary files automatically.
On Some Linux distributions, especially Slackware 3.3 and 3.4, it's been found that /var/tmp/.pop directory does not exist at all, which also causes the error to be displayed. Make sure that this directory exists with appropriate owner and group permissions.
SMTP doesn't support any form of authentication. You can restrict access based upon IP address.(that basically what sendmail anti-spam rules do. see http://www.sendmail.org/antispam.html
Other than that, you would have to roll your own authentication method. This wouldn't be particularly difficult; the problem is in designing something which would work with existing mail clients.
Recent versions of sendmail (starting with 8.9.*) are to be told which hosts are allowed to use it as relay.How to do this, usually depends on sendmail version, you are using. (with sendmail 8.9.* or later you may use one of examples from scripts section. However RedHat usually comes with sendmail 8.8.8 preconfigured to reject relaying. Here you will need to use
/etc/mail/ip-allow
and
/etc/mail/name-allow
files.
Check also out http://www.sendmail.org for further reference.
"Warning" messages being sent back to sender every XX period, if mail could not be delivered?
You generally should not need it, until you want to use it as a part of certain solution. (f.e. if your client is a dialup user, and retrieves mail using ETRN command, when comes online).
To perform this you will need to set following options to zero:
O Timeout.queuewarn=0
O Timeout.queuewarn.normal=0
O Timeout.queuewarn.urgent=0
O Timeout.queuewarn.non-urgent=0
Still this method is not adviceable, since it will also give your users a fake sense of mail being delivered to its receipt, while it just could get stuck in your mailq forever.
True that's very unethical spying your own users. Besides they could just use PGP do defeat such a policy. However, since this question has been asked for many times before, we decided to put a few guidelines here:
Incoming traffic
Basically this could be done using /etc/aliases file:
pooruser: pooruser, evilboss
another alternative could be procmail, your your own local mailer.
Outgoing traffic This routine is a bit tricky, have a look on page from Harker systems: http://www.harker.com/sendmail/copyuser.html.
Assuming your sendmail source is in /usr/src/sendmail-8.9.2/ dir:
cd /usr/src/sendmail-8.9.2/cf/cf/
m4 ../m4/cf.m4 mysendmail.mc > sendmail.cf
cp sendmail.cf /etc/