Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The "From" part...

Status
Not open for further replies.

BIS

Technical User
Jun 1, 2001
1,893
NL
Hello again.
Does anybody know if the 'from' part can be changed when sending an email (with mailx) as root? It currently says Super-User, I would love to be able to change it to, say, Bob the Builder. This is the format I use, from the command line:

cat /some/file | mailx -s "Subject" me@over.here

Any ideas?
 
It comes from the comment field in /etc/passwd. You can change it using usermod -c "Bob the Builder" root.

Greg.
 
Use sendmail command with option "-f" to send the mail. You can set the senders name with -f option.

Regds,

- Hemant
 
Many thanks. I seem to have trouble though. Could you tell me if this is the correct syntax?

cat /some/stuff | /usr/lib/sendmail -s "Subject" -f "Bob" me@over.here

When I do this I get:
Bob... User unknown
-f... User unknown
Bob... User unknown
/dead.letter... Saved message in /dead.letter

Any ideas?
 
See Sendmail command manual (by using man sendmail).. u will get correct syntax of this command..

Regds,

- Hemant
 
I am aware of 'man sendmail'.....

It seems as if the -s option is specific to mail/mailx and does not exist in sendmail. Unfortunately the -f option (which works a treat, thank you) seems only available in sendmail and not in mail/mailx. I was hoping to use both options, is this at all possible?
 
Hello again...

For anybody who might be interested, this little script did the job, which was to specify both the "From" part, the Subject, and attach a txt file:

/usr/lib/sendmail -f &quot;Bob the Builder&quot; me@over.here << END
`(
echo &quot;Subject: Some Subject Text&quot;
echo &quot;&quot;
cat /some/file
)`
`cat /another/file`
`uuencode /another/file Attachment1`
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top