Important alert: (current site time 7/15/2013 9:26:55 PM EDT)
 

VB icon

A Example of Sending Email in PerlScript

Email
Submitted on: 7/5/2003 11:43:38 PM
By: Randy McCleary 
Level: Intermediate
User Rating: By 1 Users
Compatibility: 5.0 (all versions)
Views: 12335
(About the author)
 
     This is an Example of Sending Email using the CDONTS Email component in ASP, but is written in PerlScript.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
=**************************************
= Name: A Example of Sending Email in PerlScript
= Description:This is an Example of Sending Email using the CDONTS Email component in ASP, but is written in PerlScript.
= By: Randy McCleary
=
= Inputs:<html>
<head>
<title></title>
</head>
<body>
<form method="POST" action="sendMail.asp">
<table cellspacing=0 cellpadding=4 width=50% align=center>
<tr>
 <td><font face="Arial, Helvetica, sans-serif" color="#000000" size="-1">E-mail:</td>
 <td><input type="text" name="email" size="30"><input type="submit" value="Send it"></td>
</tr>
</table>
</form>
</body>
</html>
=
=This code is copyrighted and has= limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=483&lngWId=6=for details.=**************************************

<%@ LANGUAGE="PerlScript" %>
<% 
#**************************************
#******* Get e-mail address *******
#**************************************
$strEmail = $Request->Form('email')->item;
if ($Request->ServerVariables('CONTENT_LENGTH')->item != 0) {
	#*************************************************************************************************************
	# This is the HTML String to send in the Email
	# 1. Any html like width="50%" must be in double Quotes like width=""50%""
	# 2. Make sure that all html is in quotes "<html>" and if spanning muliple lines use the _
	# and on the following line start it off with an & "Your next line of HTML " 
	#*************************************************************************************************************
	 $strMessage = '<html>< body bgcolor=""white"">';
	 $strMessage = $strMessage. '<table border=""0"" bgcolor=""ffffff"" bordercolorlight=""000000"" bordercolordark=""ffffff"" cellspacing=""0"" cellpadding=""5"" width=""600"">';
	 $strMessage = $strMessage. '<tr>';
	 $strMessage = $strMessage. '<td>< img src=""http://www.arc.com/headache/catapult.jpg"" alt=""none"" border=""0""></td>';
	 $strMessage = $strMessage. '</tr>';
	 $strMessage = $strMessage. '<tr>':
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '</tr>';
	 $strMessage = $strMessage. '<tr>':
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '<td> </td>';
	 $strMessage = $strMessage. '</tr>';
	 $strMessage = $strMessage. '</table>';
	 $strMessage = $strMessage. '</body>';
	 $strMessage = $strMessage. '</html>';
	#*************************************************************************************************************
	# This is the actual code that creates and sends the Email
	#*************************************************************************************************************
	# 1. $sendmail = Server->CreateObject("CDONTS.NewMail"); - this creates a email object
	# 2. $sendmail->{From} = Your Email address or the Address of the person who's sending it
	# 3. $sendmail->{To} = The Email address being sent to
	# 4. $sendmail->{Subject} = The subject of the e-mail
	# 5. $sendmail->{BodyFormat} = The body format of the email - 0 = HTML, 1 = TEXT
	# 6. $sendmail->{MailFormat} = The format of the mail - 0 = MIME(use for HTML), 1 = TEXT
	# 7. $sendmail->{Body} = The actual e-mail message being sent.
	# 8. $sendmail->{Importance} = The importance level - 0 = LOW, 1 = NORMAL(Defaut), 2 = HIGH
	# 9. $sendmail->Send = This line of code is what sends the message
	#*************************************************************************************************************
	 $sendmail = $Server->CreateObject("CDONTS.NewMail");
	 $sendmail->{From} = 'webmaster@domain.com (PerlScript)';
	 $sendmail->{To} = $strEmail;
	 $sendmail->{Subject} = "Simple Test Email";
	 $sendmail->{BodyFormat} = 0; 
	 $sendmail->{MailFormat} = 0;
	 $sendmail->{Body} = $strMessage; 
	 $sendmail->{Importance} = 1;
	 $sendmail->Send;
	 
	 $Response->Redirect("success.html"); 
}
$Response->Redirect("sendmail.html");
%>


Other 28 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
7/6/2003 7:52:32 AMstephen antony

again a goo work
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.