Hi,
I could be missing something here but this has worked for me (from within a .mt
script):
-- catch event
put shell("cat " & " | mail " & "-s " && "the subject " && "[EMAIL PROTECTED]" )
after buffer
put "Content-Type: text/plain" & cr & "Content-Length:" && the length of buffer &
cr & cr
put buffer
It worked for me on my linux server. It returned mail (no body text though).
Ian
Hinduism Today wrote
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.
[EMAIL PROTECTED] wrote:
>
> --------------- MESSAGE metacard.v004.n317.10 ---------------
>
> From: Sivakatirswami <[EMAIL PROTECTED]>
> Subject: .mt scripts/
> Date: Sun, 13 May 2001 19:19:35 -1000
> MIME-Version: 1.0
> Content-Type: text/plain; charset="US-ASCII"
> Content-Transfer-Encoding: 7bit
>
> 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
>
> --------------- END metacard.v004.n317 ---------------
Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.