You are already here!
Go
 

Form to Email Tutorial

  • Quick Overview
    A very common task for many websites is a form that submits its results to an email account. We commonly refer to this task as form to email. There are several ways to add form to email to your website(s) hosted at LaMarSOFT. You can use Perl, ASP, or Cold Fusion to accomplish the task. This web page explains how to send email using each of those three popular technologies.
  • Perl based form to email
    One of the most popular tools for accomplishing the form to email task is formmail.pl from Matt Wright's Script Archive. This script was written for Unix, but can also be run in the Windows 2000 environment here at LaMarSOFT. There are a few things to keep in mind when using a Unix based perl script at LaMarSOFT.

    1) You do not need to CHMOD scripts on Windows 2000 machines. Just place them in the cgi directory.
    2) You do not need to know the path of Perl for any Perl script you host at LaMarSOFT.
    3) Some pathnames will need to be changed, since the directory structures of Windows 2000 differ from Unix.
    4) Perl scripts must end in .pl
    5) '.cgi' will not execute as Perl (rename .cgi extensions to .pl)
    6) $mailprog = 'c:\\sendmail\\sendmail';
  • ASP based form to email
    At Windows 2000 based hosts such at LaMarSOFT, ASP can be used to accomplish the task of form to email. At LaMarSOFT, we do not support CDONTS. For sending email via ASP, we support ASPmail. Here is a code sample for sending email from an ASP page at LaMarSOFT.

    <%
    Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
    Mailer.FromName   = "LaMarSOFT.com"
    Mailer.FromAddress= "Joe@lamarsoft.com"
    Mailer.RemoteHost = "mail.lamarsoft.com"
    Mailer.AddRecipient "John Smith", "jsmith@whereever.com"
    Mailer.Subject    = "Great eMail Hosting!"
    Mailer.BodyText   = "Dear John" & VbCrLf & "This web host rocks!"
    if Mailer.SendMail then
      Response.Write "Mail sent..."
    else
      Response.Write "Mail send failure. Error was " & Mailer.Response
    end if
    %>
  • Cold Fusion based form to email
    If you prefer to code your pages in Cold Fusion, you can use Cold Fusion to accomplish the task of form to email. Cold Fusion uses the CFMAIL command to send email. The following code could be used within a Cold Fusion page to send email.

    <CFMAIL FROM="#MailFrom#" TO="#MailTo#" SUBJECT="#Subject#">

    #MailMessage#

    </CFMAIL>

  • Important Things to Consider
    When sending email from your domain hosted at LaMarSOFT, the LaMarSOFT email servers will not allow email to relay unless the FROM or TO address in the email is a valid local email address. If your form to email page appears to work, but the email never arrives at the destination, check to make sure either the FROM or TO address is a valid local email address at your domain.

    Please remember that our email servers are not to be used as spam cannons. Do not write a script that sends lots of spam. Sending spam through our servers wastes CPU time and bandwidth, and can degrade performance. Any script being used to cannon spam will be instantly removed without any warning.

  • FAQs
  • Privacy Policy

© 1996, 1997,1998,1999, 2000, 2001 LaMarSOFT.com. All rights reserved. All other trademarks are the sole property of their respective owners. We only recommend products that we have personally tried or use regularly. Performance of any product or service is the sole responsibility of its creator/owner. We assume no responsibility for advice, tips, scripts, or programs provided here since we have no control over their ultimate use or implementation. As always -- make a backup first! Your privacy is important to us. Please read our Privacy Statement for details. We may be contacted at webmaster@lamarsoft.com.
Last Updated: Sunday February 10, 2002

LaMarSOFT Clients