porting perl script which uses sendmail?

Discussion in 'HTML / PHP / JavaScript / CSS' started by jerrykarn, May 28, 2003.

  1. 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
     
  2. 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
     
  3. 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>

    <%
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName = "FROMNAME"
    Mailer.FromAddress= "[email protected]"
    Mailer.RemoteHost = "localhost"
    Mailer.AddRecipient "Someone", "[email protected]"
    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>
     
  4. thanks!
     

Share This Page