I suggest you do this one step at a time. Lets get your sendmail working
correctly first and foremost. You'll need to enter your local domains one
per line into a file. With RedHat 6.2 I think this was either
/etc/sendmail.cw or /etc/mail/sendmail.cw but you will find a reference to
this in /etc/sendmail.cf. (RH 7.0? & up use /etc/mail/local-host-names).
If you've not set your hostname up correctly you might like to quickly
fudge the sendmail.cf file to have a line
Djmy.email.domain.com.au
That's not a typo, Dj must be immediately followed by the domain. Some
will point out that you should set things in the sendmail m4 macro file,
that's cool, just that I've never gotten around to looking at it myself.
Once that's done you can check simple local delivery (actually I think
this may be independent of sendmail)
date | mail user
ls -l /var/spool/mail/user
The mail ends up in just one big file for the user.
Next try this via SMTP. In the example below ">" means the server responds
and "<" means you type this.
<telnet localhost 25
>Trying 127.0.0.1...
>Connected to localhost.localdomain (127.0.0.1).
>Escape character is '^]'.
>220 gripz SMTP daemon ready.
<helo localhost
>250 gripz pleased to meet you, localhost
<mail from: [EMAIL PROTECTED]
>250 sender is [EMAIL PROTECTED], sender OK
<rcpt to: grant@localhost
>250 recipient grant@localhost, recipient OK
<data
>354 OK End with <CRLF>.<CRLF>
<Merry Xmass
<.
>250 Message accepted for delivery
<quit
>221 Closing connection
>Connection closed by foreign host.
Again this should end up as legible text in /var/spool/mail/grant (in this
case). As an excercise you can also type 'help' within the telnet session.
Next you need to possibly adjust /etc/mail/access and ensure you LAN has
RELAY access. EG:
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
192.168.1. RELAY
As I pointed out earlier today, you then need to
cd /etc/mail
make
to recompile the access.db and other .db files in this directory.
Next try the SMTP session above but telnet to your LAN's address (ie the
IP of your ethernet card). It should work just as well now that you've
given access to the LAN.
Next try your Windows/MAC clients on the LAN to make sure they can send to
each other and that the various /var/spool/mail/* files end up with the
messages.
You might as well try pop at this point, if the imap RPM is installed
ensure that there's a line in /etc/inetd.conf that has pop3 or pop-3 or
similar that is enabled (or if you've got xinetd instead a file called
/etc/xinetd.d/ipop3d that has 'disabled = no'). If you change these files
use /etc/rc.d/init.d/inetd restart (substitute xinetd if needed).
Now if you've got POP enabled you should be able to
"telnet localhost 110" and get some sort of message saying POP is ready. I
don't remember how to fudge this one but it does respond to "Quit".
Next telnet <ethernet IP> 110, should also respond
Next get your windows/mac clients to try to pickup mail.
At this point you should be able to pump emails to & from people
internally.
Next try to send an email externally, this'll probably work as well.
Verify this by doing it while the following command is running
"tail -f /var/log/maillog"
You should see a line that among other things says
'relay=some.host.name [IP address]' and also 'stat=Sent'. Otherwise it may
say 'stat=Queued' if you're offline and all sorts of other things for
failures. If it does fail and you can't work it out post the last 20 or so
lines in another email to SLUG. You can press CTRL-C to stop the "tail -f"
command.
NOW the fetchmail/getmail/other pop software
Essentially you can use something like this:-
"
poll pop-server.nsw.bigpond.net.au proto pop3:
user fred1, with password fredpass, is fred here;
user barney1, with password barnpass, is barney here;
poll pop.zip.com.au proto pop3:
user fredrick, with password fredpass, is fred here;
"
in your /root/.fetchmailrc file or whatever. Then use the "fetchmail -v"
command to follow what's going on. If you did the telnet excercises before
you should spot immediately what it's trying to do and where to
troubleshoot. You may be receiving mail for an unexpected domain for
example and sendmail will respond with "We do not permit relaying" or
something like that, so go add it to the /etc/mail/sendmail.cw file (or
whatever it was for your setup).
If you've got a multi-drop mailbox (ie one mailbox that gets mail for
everyone in your company & must be split up), well this isn't for the
novice fetchmail user but it can certainly do it. Till you learn to split
it up, direct all mail to one mailbox then manually forward to the correct
person in your organisation. Think about what criteria you are basing this
decision on and that might clue you in on the multi-drop setup.
Just one other thing with pop. I carefully avoided the use of a local MUA
(Mail user agent) such as pine/mutt/elm as this can mark the messages as
'read' which may cause POP to skip these. Shouldn't be a problem with IMAP
though.
More comments between the lines below
On Fri, 21 Dec 2001, Edwin Humphries wrote:
>
> I'm trying to run a sendmail/imapd/getmail (or
> fethchmail, but getmail is what I'm playing with at the
> moment) setup to:
>
> send mail from clients via SMTP
>
> collect mail from external pop accounts and distribute
> them to relevant users (we don't have a fixed IP)
>
> trap internal emails and hold them for collection
>
> forward email to one account for an external ISP
>
> I can successfully use sendmail to send to any external
> email address, but at the moment, I'm having two
> problems:
>
> 1. I can send mail to either username@domainname, or
> username@servername; but I can't get it via pop - the
> clients (Pegasus 4 on WinNT4) don't report any error
> code on sending or receiving, but the emails (tests
> only, thankfully) aren't found. The imap server is the
> Mark Crispin one that comes with Red Hat 6.2 -
> documentation is almost non-existent. I presume it's
> not finding the sendmail mailboxes, but I don't know
> how to change this. Any suggestions would be
> appreciated.
As someone pointed out you might have something in /etc/hosts.allow &
/etc/hosts.deny blocking the connection to the server. You can try using
Windows Telnet and changing the port from 'telnet' to '110' for example.
With imap the inbox is special but other mailboxes will appear within the
'mail' or 'Mail' directory of the user's home directory.
> 2. I don't know what to configure getmail to as the
> default directories into which it will place the got
> mail, so that imapd will serve them to the clients. It
> seems the sendmail mailboxes are files rather than
> directories (is this right?); how then do I post the
> emails to them?
Let sendmail or 'deliver' write to the user's mailboxes.
> 3. I believe I can use sendmail to forward the
> emails externally using a /etc/mail/virtusertable; I've
> also picked up that I can create a .forward file in the
> user's mailbox, and it will be automatically forwarded
> (by sendmail or imapd?). Which is the better approach?
You're really confused here. The /etc/mail/virtusertable maps user@domain
to user2@domain2 and applies to mail coming in via port 25 (SMTP) (or
otherwise injected using sendmail command line). It is a more beefed up
version of /etc/aliases.
You can't compare sendmail and imapd/popd they're nothing alike. Sendmail
(or more specifically, deliver) writes to the mailbox, it is an MTA (Mail
Transport Agent) whilst imapd/popd are not, they essentially read/write to
the one mailbox under user control (hey what do you call them MUA's? I can
see why there's confusion.)
The .forward files I wouldn't use for this purpose, it's more obscure.
Leave this one to the users themselves or not at all. They can do things
like redirect it to their home ISP or something while away over the
holidays or some other bodgy 'vacation' program that probably doesen't pay
attention to "Priority: bulk" header lines <grrrr!>.
--
---<GRiP>---
Web: www.arcadia.au.com/gripz
Phone/fax: 02 4950 1194
Mobile: 0408 686 201
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug