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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendmail question

Status
Not open for further replies.

rtnMichael

Programmer
Aug 5, 2002
152
US
hey guys, I'm trying to send mail to myself along with another user on a unix test station and I was wondering if anybody knew how to send to multiple users rather than having to use an alias file to access names.

This is what I'm doing and it works fine for just me, but I need to add only one other user, and I've tried several different ways to manipulate the code without any success.

pipe = popen("/usr/lib/sendmail -f mysy mbarr@ray.com","w"))

Any clues?

Thanks
M
 
My solution was to stick the names in a for loop since the @endingextension is always the same.
 
Sorry not being a programmer, rather a script writer, I would create a variable:
EMAILADDR="anon@acme.com anotheranon@acme.com etc"
And then call that up within the script.
In this way it is also easy to add or remove names at a later date because they are always at the top of the script.
Best regards
 
what are you trying to do...
my guess is the following.
set a common script==
(note this is nothing more than an example. Use your own
ideas or pay me.)
#!/bin/ksh

MAILINGLIST=you@here.com:me@here.com
while read line
do
cat <file> |mail ${line}
done < `echo ${MAILINGLIST}|sed 's/:/ /g'`


Your C code &quot;not sure why you do this..&quot;
Should not change....
Just call the script...
if you want to trap on errors...
code that in as well with the read on your popen
some like the following: Generic as well:
if ( fd == &quot;error&quot; )
{
prinf(&quot;Error with mail script&quot;);
exit(2);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top