Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-16-2003, 06:43 AM   #1
Registered: Jun 2002
Location: UK
Distribution: Used many over the years, main ones now "CentOS", Slackware and Arch
Posts: 31

Rep: Reputation: 15
Angry sendmail from perl always sends as user "nobody"@mydomain

I have a linux box inside an "intranet" that happens to be using a Windows XP machine to provide the "internet gateway" (hey, I'm only doing that because the adsl modem manufacturer refuses to release a linux driver, you think I WANT to use XP !!)

I've got this machine configured as mybox.mydomain IP address and the XP box's internet connection wizard seems to do pretty much what a linux box with IP masquerade used to do. So my linux box can see the net, can send emails and can receive emails.

So here's the problem.

I'm trying to build a mail form and perl cgi-bin script and I wanted to test it before I let it loose in the real world. However, every time I try it on this linux box, sendmail seems to try to send the mail as if it were from "IDENT:99@mybox.mydomain" which gets translated to "nobody@mybox.mydomain".

I have checked that I can send an email from this box in the "normal" way and that it gets where I ask with the headers I expected. I used the "spruce" mail client to do this and it worked. Just to be sure, I used telnet to connect to port 25 on the linux box and manually issued a set of MAIL FROM, RCPT TO (and so on) commands and that worked.

Because the perl scripts seem to invoke sendmail with the -t option to force acceptance of To: and From: lines etc I then tried running "sendmail -t" from an xterm and I found that worked OK too. The problem, it seems, is where sendmail is invoked from the perl script.

Naturally I assumed it was all a stupid error in my own perl script, so I went off and grabbed from Matt's Script Archive and tried to use that, but no, I still get an "undelivered mail" error because the mail is being sent as if from the unknown user nobody@mybox.mydomain.

I think have forgotten to configure something. Problem is, I don't know what, and searches on "google" for things like "sendmail -t perl" don't really give me any clues and sendmail's not the easiest of things to understand how to configure, is it ?

If I've merely overlooked section "x" subsection "z.1.2.3" of the manual then feel free to tell me so.
Old 05-16-2003, 07:58 AM   #2
Registered: May 2001
Posts: 29,206
Blog Entries: 55

Rep: Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472Reputation: 3472
First of all thanks for providing that much details, that speeds up troubleshooting.

The sender is "nobody" if you're running this Perl script tru a HTTP server like Apache if it is the user the server runs as: "egrep httpd.conf e- "^(Us|Gr)" " or "\ps -eo uid,pid,args".

Could you post the lines from maillog showing the "undelivered mail" errors?
Old 05-17-2003, 12:24 AM   #3
Registered: Jun 2002
Location: UK
Distribution: Used many over the years, main ones now "CentOS", Slackware and Arch
Posts: 31

Original Poster
Rep: Reputation: 15
A few more details (and some insight, maybe)

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 ( When I ran the interactive tests I used "" 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" 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 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=<>, size=444, class=0, nrcpts=1, msgid=<200305170412.h4H4BtxJ000365@myhost.mydomain>, proto=ESMTP, daemon=MTA, relay=IDENT:1000@myhost.mydomain []
May 17 05:12:35 myhost sm-mta[365]: h4H4BtxJ000365: to=<>, 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:, 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.

Mhost map: lookup ( deferred
$_IDENT:1000@myhost.mydomain []
H?P?Return-Path: <g>
H??Received: from myhost.mydomain (IDENT:1000@myhost.mydomain [])
by myhost.mydomain (8.12.8/8.12.8) with ESMTP id h4H4BtxJ000365
for <>; 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 <>
H??Subject: test message
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,, which I presume holds the command line used when sendmail was invoked. Here are those files :-

Mhost map: lookup ( deferred
${daemon_flags}c u
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??From: (john voisey)
H??Subject: test message from perl


The file held THIS :-

/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 ?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 04:51 AM
"User Unknown" error with Sendmail girish_hilage Linux - Networking 3 09-10-2004 07:10 AM
"User" & "System" CPU load difference JJX Linux - General 3 06-06-2004 01:42 AM
Compiling KDE 3.2.0 - "Can't open perl script "/dcopidlng/kalyptus" linuxgamer09483 Linux - Software 3 04-09-2004 08:25 PM
LFS 4.1: Stalled at Perl, "missing seperator" error from "make" SparceMatrix Linux From Scratch 1 06-07-2003 03:31 PM

All times are GMT -5. The time now is 12:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration