Web Hosting Talk







View Full Version : quick ques


clocker1996
06-20-2002, 12:30 AM
I have a file called ken.txt
inside ken.txt is just a paragraph
just words
sentences
anyway

if you do

cat ken.txt | mail clocker@mydomain.com

it will email me everything in ken.txt
but it shows as
from: root@myserver'shostname in my inbox

so my servers hostname is
rockstar.mydomain.com

so it says root@rockstar.mydomain.com

All i want to do is figure out how to make it so i can email clocker@mydomain.com the contents of ken.txt via the command line, but make it say from email address: bob@mydomain.com
you konw? so when i check my inbox it says its from bob@mydomain.com

so when i hit reply i'll be replying back to bob@mydomain.com

Does anyone know how to do this from command line?

you might think 'man mail' -- but that doesn't give me any info on hwo to do it, maybe i' missing something

even tried

adduser bob
cat ken.txt | mail -u bob clocker@mydomain.com

then it says

bob@rockstar.mydomain.com which is not good
need it to say mydomain.com

Anyone have any idea?

clocker1996
06-20-2002, 01:40 AM
n/m got it

neil
06-20-2002, 01:40 AM
try..

cat file_name.txt | /usr/sbin/sendmail -O NoRecipientAction=add-to -f from@ddress to@address

elsmore1
06-20-2002, 02:09 AM
If you want to specify multiple header fields, it could be done like this...

echo "From: me@mydomain.com
To: My Name <myname@example.com>
Bcc: secret-address@somewhere-else.com
Subject: This is a test" \
| cat - /home/myacct/file.txt \
| /usr/sbin/sendmail -oi -t

Of course, if you were going to do this often, you would probably want to create a text file with the appropriate headers in it, then just cat the two files to sendmail.