Web Site Creator Web Hosting Help
   How to Send Email


This is a very basic form that you can use in your pages.  There are two methods - one is that you can modify the HTML on this page to suit your needs, or you can take the form out (and remove the submit conditional) and have another page post the results to the perl script for processing.
 
Form mail script
# Example for sending email using NET::SMTP built-in library
#!c:\perl\bin\perl.exe
use Net::SMTP;
use CGI;

# Create the CGI object
my $query = new CGI;

# Output the HTTP header
print $query->header();

# check for submitted form and assign path accordingly
if ( $query->param("submit") )
{
$emailto = $query->param("emailto");
$message = $query->param("message");
$smtp = Net::SMTP->new('Your Mail Server'); # connect to an SMTP server
die print "Couldn't connect to server" unless $smtp;
$smtp->auth('Your eMail Address', 'Your eMail Password');
$smtp->mail('Senders Address'); # use the sender's address here
$smtp->to($emailto); # recipient's address
$smtp->data(); # Start the mail

# Send the header.
$smtp->datasend("To: $emailto\n");
$smtp->datasend("From: Perl Mailer\n");
$smtp->datasend("\n");

# Send the body.
$smtp->datasend("$message\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection

# Check for error and show the confirmation
if($@)
{
print $@;
}
else
{
print "Message has been sent successfully to: " . $emailto;
}
}

# input form for email information
print "<form action=\"email.pl\" method=\"post\">";
print "<input type=\"hidden\" name=\"submit\" value=\"Submit\">";
print "<p>Send to: <input type=\"text\" name=\"emailto\" value=\"$emailto\"></p>";
print "<p>Message: <input type=\"text\" name=\"message\" value=\"$message\"></p>";
print "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
print "</form>";

Sign Up Now! Overview

Questions? Call sales at
1 (425) 274-4500
Or try our
Visit our Help Center where you can get simple and quick product support.
   is an affiliate of   , a leading domain name services company.
Copyright © 1998-2018 Enom LLC. All rights reserved. Terms & Conditions | Privacy Policy | Abuse Policy