Re: [code] Any ideas ?

From: Niese-Petersen (Tenp@cris.com)
Date: 10/02/96


On Wed, 2 Oct 1996, Rasmus 'Con' Ronlev wrote:

> On Sat, 28 Sep 1996, Ebon Mists wrote:
> 
> >I am going to make my mud send an email to a user based on certian events,
> >Real e-mail, not mudmail. The first and probably worst method I thought of
> >was writing the email to a text file from within the mud, then system()'ing
> >a sendmail command. That's probably really slow and clunky and a dumbass way
> >to do it. Does anyone out there have any ideas as to a better method?
> 
> Well, when using the system() call, you might hit some sort of 'delay'
> in terms, that the execution of the command might take some time. Thus
> what you 'want' to do, is to create some sort of way to handle messages,
> that won't slow down the mud. An idea would be to write your e-mail, and
> the adresss of the person to recive the mail into a file, for example
> lib/tmp/email.x , where x would be a number. Then you could use a 'loop'
> open file thing, to write the e-mail message and the receiver in to the
> first available 'file' and thus only ysing time for looping through
> available files, and writing the file. I THINK that it won't lag, at least
> not too much. Then have a crontab script run with some interval, that
> reads there messages, and posts the mails :)
> 

Write message in a file <MAILFILE.TXT>
then:
sprintf(buf, "mail -s \"%s\" %s <MAILFILE.TXT &", subject, emailaddr);
system(buf);

:) Should handle that problem :)  The & make sure it become a background
proccess, and that way continue with the MUD at once. And then its all up
for the server to handle the two things at the same time :)
But wont affect the MUD as much if you did a system() call without &
*shiver*

---
Erik Niese-Petersen
Aka Quint The typo God
Realms of Darkness IMP [matrix.xiii.com 6666. Playertesting/Modifying]



+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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