mailx (from address issue)

Bill Campbell linux-sxs
Thu Oct 26 12:52:12 PDT 2006


On Thu, Oct 26, 2006, A. Khattri wrote:
>On Wed, 25 Oct 2006, Dirk Moolman wrote:
>
>> Hi, I have a problem where we are trying to send mail from our linux
>> servers, but would like to display in the "From" line, a specific
>> address.
>>
>> I use the -r option (man page:  -r address  - Sets the From address)
>>
>> But what currently happens, is that we receive the mail in the format:
>>
>>
>> From: <user at domain that mail was sent from on the server> on behalf of
>> (-r address)
>>
>>
>> Does this formatting come from the exchange server that we are using as
>> our relay server ?
>
>Is your linux server running an MTA? or is it just passing it along to a
>mail hub?

There are several ways to do this with the best method depending
on the complexity of the e-mails (do they need MIME parts).  For
simple text e-mails something like this should work:

(
	echo 'From: user at example.com\n\n'
	cat mailfile
DONE
) | /usr/sbin/sendmail destination

The echo command generates the from address followed by at least
one blank line which sendmail takes as the message headers.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

The very powerful and the very stupid have one thing in common.
Instead of altering their views to fit the facts, they alter the facts
to fit their views ... which can be very uncomfortable if you happen to
be one of the facts that needs altering.
                -- Doctor Who, "Face of Evil"



More information about the Linux-users mailing list