Thanks Ben Yau There is one another problem in this case... when you send this email to the people from the emails.txt list, they receive the message, but the do not see their names in the TO field. they can see the FROM address, but they do not have any entry in the TO field. Regards Rudolf ----- Original Message ----- From: "Ben Yau" <byau@xxxxxxxxxxxxxxxx> To: <redhat-list@xxxxxxxxxx> Sent: Monday, January 19, 2004 7:59 PM Subject: RE: Help Me with shell script please > > > > Actually in sendmail command we can use -F somename@xxxxxxxxxxxxxx so the > > mail will be like it is from somename@xxxxxxxxxxxxxx username > > (in the FROM > > Field of the receivers mail client). > > > > But how we can use the mail and sendmail together in one script, so that > > sendmail command will resolve the FROM Problem, and the mail > > command will do > > the rest part of this TASK ? > > > In that case, just use sendmail instead of mail. It's not as clean as > solution as the Mail::Internet example Jason just posted. So if you'r > comfortable with Perl, use that. If you are more comfortable with sendmail > and shell/file interaction, you'd do something like this in your script > (note the use of additional file messageout.txt). > > Have the message itself (no headers) in message.txt > list of email addresses in email.txt > > And a script similar to this (untested, didn't do a syntax check) > > #!/bin/bash > > > # get list > alias=`/bin/cat ./emails.txt` > fromaddress="from@xxxxxxxx" > > # enter loop for each address > for a in $alist > do > #verobse output danka > echo "mailing to $a" > > # form message > echo "Subject: this is your subject" > ./messageout.txt > echo "To: $a" >> ./messageout.txt" > echo "" >> ./messageout.txt" > cat ./message.txt >> ./messageout.txt > > # send message > cat ./messageout.txt | /usr/lib/sendmail -f $fromaddress $a > > # traffic control > sleep 3 > done > > > > -- > redhat-list mailing list > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe > https://www.redhat.com/mailman/listinfo/redhat-list -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list