Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Feb 2003 13:38:23 -0500
From:      Chuck Swiger <cswiger@mac.com>
To:        freebsd Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Setting proper From host in Sendmail
Message-ID:  <3E4FDA9F.6080508@mac.com>
In-Reply-To: <3.0.5.32.20030216104416.012b5258@sage-one.net>
References:  <3.0.5.32.20030216090543.02216038@sage-one.net> <3.0.5.32.20030216090543.02216038@sage-one.net> <3.0.5.32.20030216104416.012b5258@sage-one.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Jack L. Stone wrote:
[ ... ]
> Thanks for the reply, but that is not what I meant. I don't want the FROM
> to be replaced with the machine's host name, but the FROM field of the
> customer who fills in his email address in the web form. In other words,
> the system isn't seeing that field and is replacing with the
> "www@myhost.com".  That's the only way my "vacation" program can send an
 > autoreply to the customer. What you suggest will just send the autoreply
 > back to the machine it came from.

"perldoc -q Mail" returns some useful suggestions.  I'd recommend using 
Mail::Mailer instead of formmail.pl, because the latter has had a iffy 
security record.  If you feed the message into sendmail directly (as the 
  example shows, or via vacation, for that matter), you can use the -f 
option to sendmail:

        -fname Sets  the  name  of  the ``from'' person (i.e., the
               envelope sender of the  mail).   This  address  may
               also  be used in the From: header if that header is
               missing during initial  submission.   The  envelope
               sender  address is used as the recipient for deliv-
               ery status notifications and may also appear  in  a
               Return-Path:  header.   -f  should  only be used by
               ``trusted'' users (normally root, daemon, and  net-
               work)  or if the person you are trying to become is
               the same as the person you are.  Otherwise,  an  X-
               Authentication-Warning  header will be added to the
               message.

Of course, add the userid that formmail is running as to sendmail's list 
of trusted users, if you wish to suppress the warning header mentioned.

10-sec# cd /tmp
11-sec# cat > test_message
Subject: a test message
From: root@localhost
To: Charlie Root
Date: about now

test 1 2 3

12-sec# sendmail -f'toor@sec' root@localhost < test_message

14-sec# tail -25 /var/mail/root
Rebuilding whatis database:

-- End of weekly output --

 From toor@cswiger-sec.homeip.net Sat Feb 15 22:33:30 2003
Return-Path: <toor@cswiger-sec.homeip.net>
Received: from sec.codefab.com (smmsp@localhost [127.0.0.1])
         by sec.codefab.com (8.12.6/8.12.6) with ESMTP id h1G3XSwb028437
         for <root@sec.codefab.com>; Sat, 15 Feb 2003 22:33:28 -0500(EST)
         (envelope-from toor@cswiger-sec.homeip.net)
Received: (from root@localhost)
         by sec.codefab.com (8.12.6/8.12.6/Submit) id h1G3XSJd028436
         for root@localhost; Sat, 15 Feb 2003 22:33:28 -0500 (EST)
Message-Id: <200302160333.h1G3XSJd028436@sec.codefab.com>
Subject: a test message
From: root@cswiger-sec.homeip.net
To: Charlie@cswiger-sec.homeip.net, Root@cswiger-sec.homeip.net
Date: about now
X-Spam-Status: No, hits=3.6 required=8.0
         tests=INVALID_DATE,NO_REAL_NAME,SPAM_PHRASE_00_01
         version=2.43
X-Spam-Level: ***

test 1 2 3

-Chuck


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E4FDA9F.6080508>