1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Mail from mud Zoran's final Imp -->
<!--X-From-R13: Egrcura Lrcc <mbenaNravq.pbz> -->
<!--X-Date: Thu, 01 Jan 1998 19:51:21 +0000 -->
<!--X-Message-Id: 34ABF4A4.BEBC6212#enid,com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 9801010322.8pfc@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Mail from mud Zoran's final Imp</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:zoran#enid,com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00002.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00005.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00281.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00007.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00003">Author</A>
&nbsp;|&nbsp;<A HREF="#00003">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00003">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Mail from mud Zoran's final Imp</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Mail from mud Zoran's final Imp</LI>
<LI><em>From</em>: Stephen Zepp &lt;<A HREF="mailto:zoran#enid,com">zoran#enid,com</A>&gt;</LI>
<LI><em>Date</em>: Thu, 01 Jan 1998 13:55:16 -0600</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
Chris Gray wrote:
&gt; 
[snipped my original email function request]
&gt; I have optional stuff in my scenario to do that, and also reading and
&gt; posting to newsgroups. However, it relies on the hosting system having
&gt; a certain setup, with standard programs for sending mail and posting
&gt; news. In my Amiga setup (fairly similar to what UNIX systems use), all
&gt; of the needed stuff is actually specified on the command line to the
&gt; 'sendmail' command.
&gt; 
[snipped Chris's Amiga Imp, thanks, Chris :)]

Thanks for reminding me about this, cleaned it up, then promptly forgot about it.  You can set the
state of mailme in send_rep_out in many ways, I use  mailme = is_name( "mailme", argument ); from
within the caller, which let's players type es &lt;some long output command&gt; mailme.

Here was my final solution with a caller example first:

    send_rep_out( ch, outbuf, mailme, "Estate Help" );


void send_rep_out( CHAR_DATA * ch, char * outbuf, bool mailme, char * msub )
{
    if ( mailme )
    {
      bool saved_mail = FALSE;
      if (  ( !IS_NPC( ch ) )
         &amp;&amp; (  str_cmp( ch-&gt;pcdata-&gt;email_addy, "notset" ) )  )
      {

        char mailfilename[MSL];
        sprintf( mailfilename, "%s.mail", ch-&gt;name );
        saved_mail = save_mail_file( mailfilename, outbuf );
        if ( saved_mail )
        {
          char outbuf2[MSL];
          sprintf( outbuf2, "Email sent to %s", ch-&gt;pcdata-&gt;email_addy );
          send_to_char( outbuf2, ch );
          send_email( ch-&gt;pcdata-&gt;email_addy, msub, mailfilename );
        }
        else 
        {
          send_to_char( outbuf, ch );
          send_to_char( "\n\r@@eUNABLE TO SEND SYSTEM MAIL. @@WCheck your sendmail
settings.@@N\n\r", ch );

        }
      }
      else
      {
        send_to_char( outbuf, ch );
      }
    }
    else
    {
      send_to_char( outbuf, ch );
    }
}



void send_email( const char * m_address, const  char * m_subject, const char * mfilename )
{
  char mailbuf[MSL];
  char delbuf[MSL];
  int forkval;
  sprintf( mailbuf, "mail -s \"%s\" %s &lt;%s%s",
     m_subject, m_address, MAIL_DIR, mfilename );
  if ( ( forkval = fork() ) &gt; 0 )
  {
    sprintf( dbbuf, "Just sent email: %s", mailbuf );
    monitor_chan( dbbuf, MONITOR_DEBUG );
    return;
  }
  else if ( forkval &lt; 0 )
  {
    sprintf( dbbuf, "Error in fork for sent email: %s", mailbuf );
    monitor_chan( dbbuf, MONITOR_DEBUG );
    return;
  }
  system( mailbuf );
  sprintf( delbuf, "rm %s%s", MAIL_DIR, mfilename );
  system( delbuf );
  exit(0);
  return;
}

bool save_mail_file( const char * mfilename, char * mtext )
{
  FILE * mailfp;
  char mailfpfilename[MSL];
  fclose( fpReserve );
  sprintf( mailfpfilename, "%s%s", MAIL_DIR, mfilename );
  if ( ( mailfp = fopen( mailfpfilename, "w" ) ) == NULL )
  {
    fpReserve = fopen( NULL_FILE, "r" );
    return FALSE;
  }

  fprintf( mailfp, "%s\n", strip_color( mtext, "@@" ) );

  fflush( mailfp );
  fclose( mailfp ); 
  fpReserve = fopen( NULL_FILE, "r" );
  return TRUE;
}

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00007" HREF="msg00007.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>
<ul compact><li><em>From:</em> coder#ibm,net</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00002.html">Re: [MUD-Dev]  Wild west (was Guilds &amp; Politics)</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00005.html">Re: [MUD-Dev]	The impact of the web on muds</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00281.html">Re: [MUD-Dev] The impact of the web on muds</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00007.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00003"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00003"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] The impact of the web on muds</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<LI><strong><A NAME="00278" HREF="msg00278.html">[MUD-Dev] The impact of the web on muds</A></strong>, 
Brandon Cline <a href="mailto:brandon#sedona,net">brandon#sedona,net</a>, Thu 22 Jan 1998, 08:03 GMT
</LI>
<LI><strong><A NAME="00279" HREF="msg00279.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Caliban Tiresias Darklock <a href="mailto:caliban#darklock,com">caliban#darklock,com</a>, Thu 22 Jan 1998, 11:45 GMT
</LI>
</ul>
<LI><strong><A NAME="00275" HREF="msg00275.html">Re: [MUD-Dev]	The impact of the web on muds</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Thu 22 Jan 1998, 07:05 GMT
<UL>
<LI><strong><A NAME="00281" HREF="msg00281.html">Re: [MUD-Dev] The impact of the web on muds</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Thu 22 Jan 1998, 14:59 GMT
</LI>
</UL>
</LI>
</ul>
</LI>
<LI><strong><A NAME="00003" HREF="msg00003.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>, 
Stephen Zepp <a href="mailto:zoran#enid,com">zoran#enid,com</a>, Thu 01 Jan 1998, 19:51 GMT
<UL>
<LI><strong><A NAME="00007" HREF="msg00007.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Fri 02 Jan 1998, 00:44 GMT
<UL>
<LI><strong><A NAME="00008" HREF="msg00008.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Fri 02 Jan 1998, 16:05 GMT
<UL>
<LI><strong><A NAME="00075" HREF="msg00075.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>, 
JC Lawrence <a href="mailto:claw#under,Eng.Sun.COM">claw#under,Eng.Sun.COM</a>, Wed 07 Jan 1998, 00:22 GMT
<UL>
<LI><strong><A NAME="00084" HREF="msg00084.html">Re: [MUD-Dev] Mail from mud Zoran's final Imp</A></strong>, 
Shawn Halpenny <a href="mailto:malachai#iname,com">malachai#iname,com</a>, Wed 07 Jan 1998, 14:50 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>