The good news is that we are getting somewhere with .mt scripts and they run
quite fast as well. The old news is the blind spots are still gigantic.

The .mt script below still has some bugs in it, I am not getting a proper
set of data being written out, but that should be solvable. In the meantime
the next challenge is to know how to invoke the mail program (assumes it is
installed and properly configured on the UNIX box) from within a mc script.

in a PERL script you have to declare the path

$mailprog = '/usr/lib/sendmail';

Then later you do stuff like this:
  open(MAIL,"|$mailprog -t");
    print MAIL "To: $Config{'recipient'}\n";
    print MAIL "From: $Config{'email'} ($Config{'lastName'})\n";
etc. more PERL stuff to send the email
(very difficult compared to xTalk and
I really don't want/have time to learn PERL)

So, could some wizard insert the code in the following that would do the
same from within a .mt script?

#!/usr/local/bin/mc
on startup
  if $REQUEST_METHOD is "POST" then
  read from stdin until empty
  --OK, we have the data from the form,
  --now we decode, parse for the data values
  put urlDecode (it)  into tDataIn
  set itemdel to "&"
  put item 6 of tDataIn into tNamePair
--something is wrong with the above because I am not getting
--the expected data in tDataIn, which should be a single urlEncoded
--string from the form submission

  repeat for each item x in tDataIn
    set the itemdel to "="
    put item 2 of x & "|" after tDataSubmitted
    set the itemdel to "&"
  end repeat
 -- the parsing routine above still has bugs... because the data
 -- is not what we are expecting
 -- next we write out the data...this works fine.

  put tDataSubmitted & cr after url "file:/tmp/form_data.txt"

--now we get the person's name from the data and send him back and
--html file submission acknowledgement, the template for which is on disk.
  set itemDel to "="
  put item 2 of tNamePair into tName
  put url "file:/tmp/test_response.html" into tResponse
  replace "the_name" with tName in tResponse
  put "Content-Type: text/html" & cr
  put "Content-Length:" && the length of tResponse & cr & cr
  put tResponse

--The above works
--Now, next is where we would like to send an email to the
--person responsible for handling/monitoring the submissions from
--this particular form or to various list servers who send
--invitations subscribe people etc.
--how do we do that in a .mt script?

CODE NEEDED HERE

 end if
end startup 

It's a bit tough slogging through this as I have to send my script to a
sysop to install, then I test, we review results, I write another script
send to him, wait for him to install.... still trying to get the sign up to
simon's site to work....

TIA! 

Hinduism Today

Sivakatirswami
Editor's Assistant/Production Manager
[EMAIL PROTECTED] 
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org



Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to