I struggled with serveral of the Perl scripts that require Unix-style
'sendmail' interfaces and ended-up writing my own ASP script.
Since my server is NT, this was a lot easier (ASP scripting is built into
IIS). I used the Jmail COM object to provide the hooks for programmatically
sending the mail.
Note that most of our webhosting customers are not really Perl experts
either, and when we explain that the they can run the script from our shared
script library and not-to-worry that it ends in ".asp" instead of ".cgi"
they are quite happy.
With the usual caveats (use at your own risk), here's the source code for my
mail-to-form.asp. I don't profess to be an ASP expert, but the following
works for us.
---START SCRIPT-------------
<% Response.Buffer = true %>
<html>
<head>
<title>Mail-A-Form: Send e-mail from a form</title>
</head>
<body>
<%
FormRecipient = Request.Form("TO")
FormSuccess = Request.Form("SUCCESS")
If isempty (FormRecipient) then
Response.Write "<p>Error! No recipient specified in the input form!</p>"
Response.Write "<p>(Please notify the owner of this webpage)</p>"
else
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "smtp.yourserver.com:25"
JMail.Sender = "[EMAIL PROTECTED]"
JMail.Subject = "Form Data from Webpage"
JMail.AddRecipient FormRecipient
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables ("REMOTE_ADDR")
JMail.Body = "----Form Data Follows----" & vbCrLf
For each key in Request.Form
FormKey = UCase(key)
If FormKey <> "TO" AND FormKey <> "SUCCESS" then
JMail.AppendText FormKey & ": " & Request.Form(key) & vbCrLf
end if
next
JMail.Execute
If isempty (FormSuccess) then
FormSuccess = Request.ServerVariables("HTTP_REFERER")
Response.Write "<p>The information has been received.</p>"
Response.Write "<p>Click <a href=""" & FormSuccess & """>here</a> to
continue...</p>"
else
Response.Clear
Response.Redirect FormSuccess
end if
end if
%>
</body>
</html>
--------END SCRIPT-------------
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Paul Woo
Sent: Wednesday, September 15, 1999 9:31 AM
To: [EMAIL PROTECTED]
Subject: Re: [IMail Forum] FormMail with IMail
yes, but you edit it to be used with imail
the script is written for unix with sendmail
imail doe not work the same as imail
the variable $mailprog must be changed to the path of imail1.exe
i.e., c:\\imail\\imail.exe
notice the double back slashes
in the section that print data to $mailprog, you must change it to be
printed to a text file
and then the file is sent out
you'll need a line like the following
system $mailprog <-t address of the recipient> <-s subject of the message>
<-f path to your text file>;
leave out the angle brackets, the semi-colon at the end of the line is
necessary
any reference to an email address such as [EMAIL PROTECTED]
must be written as someone\@xxx.com, notice the back slash in front of the @
of course your nt must have ntperl5 install and the script must be named
with the .pl extension and your registries must be set to recognize the .pl
extension so that perl.exe can be executed to run the script and finally you
iis directory folder must be set to allow script execution.
last but not least, you'll need to have a basic understanding of perl
statements before editing, otherwise you script may not run and put itself
into an endless loop and lock up your nt and a reboot is needed.
hope this is helpful
Paul woo
elp networks
el paso, texas
Has anyone used FormMail.pl (by Matthew Wright originally
for Sendmail on Unix) with IMail on NT?
Or is there a simpler solution for NT w/IIS and IMail?
Thanks,
John
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.