Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

  

  

  Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

  

  

  

  

 

FAQ

DOWNLOAD ReferenceASP ExamplesVisual Basic Examples


Chilkat Mail Example
Send an Email from an HTML form

This example demonstrates using an HTML form to collect information and send Email.

IMPORTANT: If Chilkat Mail and Chilkat WebMail are separate components.
If you are using Chlilkat WebMail, the code is the same, but the names of the components created are different. Use CreateObject("ChilkatWebMail.WebMailMan") instead.

This is the HTML form:

<HTML>
<HEAD>
<TITLE>Chilkat Mail Example: Send an Email from an HTML form</TITLE>
</HEAD>
<BODY>

<form method="post" action="send_email.asp">
  <p>Fill out this form, click Submit, and your email will be sent.<br>
  </p>
  <table width="75%" border="0">
    <tr> 
      <td width="42%" nowrap> 
        <div align="right">Your Name</div>
      </td>
      <td width="58%"> 
        <input type="text" name="fromName" size="40">
      </td>
    </tr>
    <tr> 
      <td width="42%" nowrap> 
        <div align="right">Your Email Address</div>
      </td>
      <td width="58%"> 
        <input type="text" name="fromAddress" size="40">
      </td>
    </tr>
    <tr> 
      <td width="42%" nowrap> 
        <div align="right">Recipient Name</div>
      </td>
      <td width="58%"> 
        <input type="text" name="toName" size="40">
      </td>
    </tr>
    <tr> 
      <td width="42%" nowrap> 
        <div align="right">Recipient Email Address</div>
      </td>
      <td width="58%"> 
        <input type="text" name="toAddress" size="40">
      </td>
    </tr>
    <tr> 
      <td width="42%" nowrap> 
        <div align="right">Subject</div>
      </td>
      <td width="58%"> 
        <input type="text" name="emailSubject" size="40">
      </td>
    </tr>
    <tr> 
      <td height="163" valign="top" width="42%" nowrap> 
        <div align="right">Email Text</div>
      </td>
      <td height="163" width="58%"> 
        <textarea name="emailText" cols="60" rows="10"></textarea>
      </td>
    </tr>
  </table>
  <p>
  <input type="submit" value="Submit">
  </p>
</form>

</BODY>
</HTML>

This is the form target (send_email.asp):

<%@ LANGUAGE="VBSCRIPT" %>

<HTML>
<HEAD>
<TITLE>Chilkat Mail Example: Send an Email from an HTML form</TITLE>
</HEAD>
<BODY>

Sending email....<br><br>

<%
	' Create a mailman.  The mailman can send and receive Email.
	set mailman = Server.CreateObject("ChilkatMail.ChilkatMailMan")

	' Get the UnlockCode free from http://www.chilkatsoft.com
	mailman.UnlockComponent "unlock code"

	' Tell the mailman where the SMTP server is located
	mailman.SmtpHost = "smtp.my_company.com"

	' Create an empty Email message
	set email = Server.CreateObject("ChilkatMail.ChilkatEmail")

	' Enter the recipient's information from form variables.
	email.AddTo Request.Form("toName"), Request.Form("toAddress")

	' Enter the sender's information from form variables.
	email.FromName = Request.Form("fromName")
	email.FromAddress = Request.Form("fromAddress")

	' Enter the email subject
	email.Subject = Request.Form("emailSubject")

	' Enter the email text
	email.Body = Request.Form("emailText")

	' Send the email
	if mailman.SendEmail(email) then
		Response.write "Message sent successfully!<br><br>"
	else
		Response.write "ERROR: Message not sent!<br><br>"
	end if

	' Standard ASP cleanup of objects
	Set email = Nothing
	Set mailman = Nothing

%>

<BR>DONE.<BR>

</BODY>
</HTML>

 

About Chilkat


Privacy Statement. Copyright 2000-2009 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, and Windows 95/98/NT4.