PDA

View Full Version : porting perl script which uses sendmail?


jerrykarn
05-28-2003, 06:16 AM
I am uploading a pre-built website, which has a form and a perl script to email the fields to the webmaster via sendmail.
here's a snippet:

open (MAIL,"|/usr/sbin/sendmail -t -n -oi") ||
die "there was a problem with the call to sendmail";

print MAIL "To: $tomail\n";
print MAIL "From: $in{'name'} <$in{'email'}>\n";
print MAIL "Reply-To: $in{'Email'}\n";
.....etc.

So, I know the Bill Gates world doesn't have sendmail, so how do I send my forms' data?

If the answer is long and painful, I welcome links to good information.

Many thanks! -Jerry

jerrykarn
05-28-2003, 06:25 AM
Ok, I'm trying to answer my question on my own....Looks like I want to use the ASPmail component.

I've seen the code snippets from this site's kbase..but it doesn't show how to use it:
-as the "POST" action on a form
-showing the form's fields being referenced in the email.

If any of you have done a form that generates an email, and could throw me a snippet of code, I'd be very grateful.

Again, many thanks for any opinions you can offer!

-jerry

SteveNJ
05-29-2003, 06:41 AM
I think this'll do it, it's pretty close to what I've used before.

When you post to a new page:
<form name="mail" method="post" action="newpage.asp">


Newpage.asp:
<html>
[b]
<%
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "FROMNAME"
Mailer.FromAddress= "from@emailaddress.com"
Mailer.RemoteHost = "localhost"
Mailer.AddRecipient "Someone", "someone@somewhere.com"
Mailer.Subject = request.form("subject")
Mailer.BodyText = request.form("body")
if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>
</body>
</html>

jerrykarn
05-29-2003, 07:36 AM
thanks!