From a2d538bc2850db48dede1e7deb3cc80a395d7b15 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Tue, 15 Jan 2002 05:36:24 +0000 Subject: add w3mmail.cgi.in --- scripts/w3mmail.cgi.in | 287 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100755 scripts/w3mmail.cgi.in diff --git a/scripts/w3mmail.cgi.in b/scripts/w3mmail.cgi.in new file mode 100755 index 0000000..90bcb0c --- /dev/null +++ b/scripts/w3mmail.cgi.in @@ -0,0 +1,287 @@ +#!@PERL@ + +$rcsid = q$Id: w3mmail.cgi.in,v 1.1 2002/01/15 05:36:24 ukai Exp $; +($id = $rcsid) =~ s/^.*,v ([\d\.]*).*/$1/; +($prog=$0) =~ s/.*\///; + +$query = $ENV{'QUERY_STRING'}; +$url = $query; +$SENDMAIL = '/usr/lib/sendmail'; +$SENDMAIL = '/usr/sbin/sendmail' if -x '/usr/sbin/sendmail'; + +$qurl = &html_quote($url); + +if ($query =~ s/^\w+://) { + $to = $query; + $opt = ''; + if ($to =~ /^([^?]*)\?(.*)$/) { + $to = $1; + $opt = $2; + } + %opt = &parse_opt($opt); + + @to = ($to); + push(@to, $opt{'to'}) if ($opt{'to'}); + $opt{'to'} = join(',', @to); + $body = $opt{'body'}; + delete $opt{'body'}; + + print "200 HTTP/1.0 OK\r\n"; + print "Content-Type: text/html\r\n"; + print "w3m-control: END\r\n"; + print "w3m-control: PREV_LINK\r\n"; + print "\r\n"; + print "W3M Mailer: $qurl\n"; + print "

W3M Mailer: $qurl

\n"; + print "
\n"; + print "\n"; + print "\n"; + if ($opt{'from'}) { + print "\n"; + delete $opt{'from'}; + } + foreach $h ('to', 'cc', 'subject') { + print "\n"; + delete $opt{$h}; + } + foreach $h (keys %opt) { + $h = &html_quote($h); + $v = &html_quote($opt{$h}); + print "\n"; + } + print "
From:" . &html_quote($opt{'from'}) + . "
\u$h:"; + if ($opt{$h}) { + print &html_quote($opt{$h}); + print ""; + } else { + print ""; + } + print "
$h$v