First, thanks for the prompt response. Your post set me thinking and I went off to do a bit of detective work, which is why I've taken until now to reply.
First I'd like to clear up the business about the mail being "undelivered". As I mentioned in my initial post, I have tried sending mail from my linux box using "spruce", by telnetting to my linux box's port 25, by running sendmail -t in an xterm and finally by invoking a perl script from a form on the apache server on this box.
All these tests attempted to send an email to an account I have on freeserve. I set up my spruce mail client with the email address of a different account on a domain that I own (velvetwood.co.uk) When I ran the interactive tests I used "john.voisey@velvetwood.co.uk" as the parameter in the "MAIL FROM" command. When I ran the perl script I input that email address into the mail form as the "from" address.
In every case EXCEPT the perl script, the freeserve smtp mailer accepted a connection from my sendmail software and proceeded to accept the message and deliver it. In the case of the mail queued by my perl script, the freeserve smtp server rejected it as undeliverable because it could not resolve the email address "nobody@myhost.mydomain" which it believed the mail was being sent from.
Yesterday the freeserve server was very busy and several times it told my sendmail software to defer delivery because too many other people were connected. This gave me the chance to have a really good look at the files in /var/spool/mqueue and also in the /var/spool/clientmqueue directory. I noticed something but at that critical moment my machine managed to connect and cleared out the queue ! Arrgghh!
In order to ensure I had the queued files for long enough to peruse them, I disconnected my adsl modem. Of course, this caused a few problems, not least being that my own sendmail software now refused to accept mail because it was unable to resolve the sender's domain field while the modem was offline ! Arrgghh ! However, by temporarily editing the linux box's hosts file, I was able to fool it into "resolving" velvetwood.co.uk so it would accept, and then queue, the mail !!
So this is what I found.
First of all, this is the "maillog" file.
The mail to "eric@redbearde.. " was sent from my spruce email client, and the mail after it to "yoryck@redbearde..." came from the perl script. Notice that the former says it's from my velvetwood.co.uk account, the latter says it's from "nobody"
May 17 05:10:01 myhost sm-mta[284]: starting daemon (8.12.8): SMTP+queueing@00:25:00
May 17 05:10:01 myhost sm-msp-queue[287]: starting daemon (8.12.8): queueing@00:25:00
May 17 05:12:35 myhost sm-mta[365]: h4H4BtxJ000365: from=<john.voisey@velvetwood.co.uk>, size=444, class=0, nrcpts=1, msgid=<200305170412.h4H4BtxJ000365@myhost.mydomain>, proto=ESMTP, daemon=MTA, relay=IDENT:1000@myhost.mydomain [192.168.0.4]
May 17 05:12:35 myhost sm-mta[365]: h4H4BtxJ000365: to=<eric@redbearde.freeserve.co.uk>, delay=00:00:00, mailer=esmtp, pri=30325, dsn=4.4.3, stat=queued
May 17 05:16:48 myhost sendmail[409]: h4H4GSwa000409: from=nobody, size=466, class=0, nrcpts=1, msgid=<200305170416.h4H4GSwa000409@myhost.mydomain>, relay=nobody@localhost
May 17 05:16:48 myhost sendmail[409]: h4H4GSwa000409: to=yoryck@redbearde.freeserve.co.uk, delay=00:00:20, mailer=esmtp, pri=30119, dsn=4.4.3, stat=queued
--------------------------------------------
Now here are the mqueue files :-
First, the one queued from my spruce client. This was put in /var/spool/mqueue. Notice the S<john.voisey .....> 13
lines down.
V6
T1053144755
K1053144755
N1
P30325
Mhost map: lookup (redbearde.freeserve.co.uk): deferred
Fbs
$_IDENT:1000@myhost.mydomain [192.168.0.4]
$rESMTP
$smyhost.mydomain
${daemon_flags}
${if_addr}192.168.0.4
S<john.voisey@velvetwood.co.uk>
rRFC822;
eric@redbearde.freeserve.co.uk
RPFD:<eric@redbearde.freeserve.co.uk>
H?P?Return-Path: <g>
H??Received: from myhost.mydomain (IDENT:1000@myhost.mydomain [192.168.0.4])
by myhost.mydomain (8.12.8/8.12.8) with ESMTP id h4H4BtxJ000365
for <eric@redbearde.freeserve.co.uk>; Sat, 17 May 2003 05:12:35 +0100
H?M?Message-Id: <200305170412.h4H4BtxJ000365@myhost.mydomain>
H??Date: Sat, 17 May 2003 05:11:55 BST
H??From: john voisey <john.voisey@velvetwood.co.uk>
H??To:
eric@redbearde.freeserve.co.uk
H??Subject: test message
H??Reply-To:
john.voisey@velvetwood.co.uk
H??X-Mailer: Spruce 0.6.5 for X11 w/smtpio 0.7.9
H??MIME-Version: 1.0
H??Content-Type: text/plain; charset="iso-8859-1"
H??Content-Transfer-Encoding: 8bit
In contrast, the perl script's output was NOT queued in /var/spool.mqueue. Instead it went into the directory /var/spool/clientmqueue. In here I found three files, the header, the mail message, and another file, sm-client.pid, which I presume holds the command line used when sendmail was invoked. Here are those files :-
V6
T1053144988
K1053145008
N1
P30119
Mhost map: lookup (redbearde.freeserve.co.uk): deferred
Fbs
$_nobody@localhost
${daemon_flags}c u
Snobody
Anobody@myhost.mydomain
rRFC822;
yoryck@redbearde.freeserve.co.uk
RPFD:yoryck@redbearde.freeserve.co.uk
H?P?Return-Path: <g>
H??Received: (from nobody@localhost)
by myhost.mydomain (8.12.8/8.12.8/Submit) id h4H4GSwa000409;
Sat, 17 May 2003 05:16:28 +0100
H?D?Date: Sat, 17 May 2003 05:16:28 +0100
H?x?Full-Name: nobody
H?M?Message-Id: <200305170416.h4H4GSwa000409@myhost.mydomain>
H??To:
yoryck@redbearde.freeserve.co.uk
H??From:
john.voisey@velvetwood.co.uk (john voisey)
H??Subject: test message from perl
-----------------------
The sm-client.pid file held THIS :-
287
/usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
------------------------------
Now, from all that, I see that the "H??From: " field has been set to the value I asked in both cases, but crucially, the perl script's interaction with sendmail resulted in a file with an "S" field set to "nobody" and I guess this must be the field that the smtp server at Freeserve's end tries to validate as legit (and obviously fails in so doing)
Is there a solution to this ?