home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / serwery_www / websuite / websuite.exe / FORMMAIL.AP_ / FORMMAIL.AP
Text File  |  1999-01-12  |  1KB  |  55 lines

  1. <[
  2.     // FORMMAIL.AP
  3.     // (c) 1998 by SmartDesk, Inc., All Rights Reserved
  4.     //
  5.     // You are free to use this code without charge provided you
  6.     // agree to abide by the terms and conditions of the licensing
  7.     // agreement located on the SmartDesk web site (www.smartdesk.com).
  8.  
  9.     LIBRARY sdmail
  10.  
  11.     session = new( "session", param( 1 ), param( 2 ) )
  12.     mail = new( "sendmail", session )
  13.  
  14.     // Make sure they're from your server
  15. //    ClientHost = session.data( "CLIENT_HOST" )
  16. //    if ( ClientHost != "smartdesk.com" )
  17. //        return( "" )
  18. //    end
  19.  
  20.     returl = session.var( "returl" )
  21.     if ( strempty( returl ) )
  22.         returl = session.data( "REFERER" )
  23.     end
  24.  
  25.     // initialize mail debugging to display connection details 
  26.     // in the output window
  27.     mail.debug = 1
  28.  
  29.     form_title = session.var( "form_title" )
  30.     req_fields = session.var( "req_fields" )
  31.  
  32. //    mail.GetVars( )
  33.     mail.to = "webmaster@smartdesk.com"
  34.     mail.tohost = ""
  35.     mail.from = "webmaster@smartdesk.com"
  36.     mail.fromhost = ""
  37.     mail.subject = form_title
  38.     mail.msg = "Data submitted on " + date( "MMMM DD, YYYY" ) + " at " + timetostr( time( ), 0 ) + "m\r\n\r\n"
  39.  
  40.     cnt = chrcount( ";", req_fields ) + 1
  41.     for ( i=1; i<=cnt; i++ )
  42.         fieldname = strextract( req_fields, ";", i )
  43.         mail.msg += fieldname + "=" + session.var( fieldname ) + "\r\n"
  44.     end
  45.  
  46.     mail.send( )
  47.  
  48.     if ( ! strempty( returl ) )
  49.         session.redir( returl )
  50.     end
  51.     
  52.     return( 1 )
  53. ]>
  54.  
  55.