Re: Email

From: Steve (quickey@cyberverse.com)
Date: 07/05/96


On Fri, 5 Jul 1996, Sammy wrote:

> On Thu, 4 Jul 1996, M.A.Clubine wrote:
> 
> > How would you tell c code to email out information.  Such as everytime a 
> > player was created, write to the text file, and email to someone@edu?
> 
> I'm not sure if this is exactly correct (man mail to be sure), but I 
> think you can do something like this:
> 
>   sprintf(buf, "mail %s < newbie_help.txt &", ch->email);
>   system(buf);
> 
> Assuming you have a variable ch->email for a player's email address, and 
> a newbi help file named as above in your lib directory (maybe put it in 
> lib/text instead) I think this will send the helpfile to their address.  
> Somebody point out the security hole in this, since I'm sure one exists.

You can encluse the %s in \" to insure its an argument and not a string 
passed to the shell
e.g.
sprintf(buf, "mail \"%s\" < newbie_help.txt &", ch->email);
system(buf);

however it might be safer to fork() (i know i know fork is BAD) or have 
another program to send the mail, or write your own mailing routines as 
shelling will lag your players for a bit



This archive was generated by hypermail 2b30 : 12/07/00 PST