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

  

  

  

  

  

 

ASP Email Component

DOWNLOAD ReferenceASP Examples


WebMail Example

Send a personalized e-mail with the mail merge feature

This example creates a single e-mail object and personalizes it for each recipient.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Chilkat WebMail Example: Mail Merge</TITLE>
</HEAD>
<BODY>

<%
	' Create a mailman
	set mailman = Server.CreateObject("ChilkatWebMail.WebMailMan")

	' Unlock the component - use your trial or purchased unlock code.
	mailman.UnlockComponent "unlock_code"

	' Tell the mailman where the SMTP server is located
	mailman.SmtpHost = "localhost"

	' Create an Email message
	set email = Server.CreateObject("ChilkatWebMail.WebEmail")

	' Enter the recipient's information.  These strings will be replaced 
	' with the recipient's name and address before sending.
	email.AddTo "%%NAME%%", "%%ADDRESS%%"

	' Enter the sender's information
	email.FromName = "John Doe"
	email.FromAddress = "john.doe@somedomain.com"

	' Enter the email subject.  This contains strings that will be substituted
	' before sending.
	email.Subject = "Important News for %%NAME%% regarding PRODUCT_NAME"

	' Enter the email text
	email.Body = "Hello %%NAME%%," & vbCrLf & vbCrLf & "Did you hear the news? ..."

	' Personalize this email by defining the replacement patterns and strings.
	email.SetReplacePattern "%%NAME%%","Chilkat Software" 
	email.SetReplacePattern "%%ADDRESS%%","chilkat@chilkatsoft.com" 
	email.SetReplacePattern "PRODUCT_NAME","Chilkat Mail 8.0" 

	' When the mail is sent, the patterns are replaced.
	if mailman.SendEmail(email) then
		Response.write "Message #1 sent successfully!<br><br>"
	else
		Response.write "ERROR: Message #1 not sent!<br><br>"
	end if

	' Personalize it again by resetting replacement patterns
	email.SetReplacePattern "%%NAME%%","Bill Yahoo" 
	email.SetReplacePattern "%%ADDRESS%%","yahoo@chilkatsoft.com" 
	email.SetReplacePattern "PRODUCT_NAME","Chilkat Zip 8.0" 

	' Send the email again, but now the patterns are replaced 
	' with the new information.
	if mailman.SendEmail(email) then
		Response.write "Message #2 sent successfully!<br><br>"
	else
		Response.write "ERROR: Message #2 not sent!<br><br>"
	end if
%>
    <br>(View page source to see the log)
    <XML ID="XMLID">
<%
    Response.write mailman.GetInstanceLog()
%>
    </XML>
<%

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

%>



</BODY>
</HTML>


 

 


Privacy Statement. Copyright 2000-2012 Chilkat Software, Inc. All rights reserved.

(Regarding the usage of the Android logo) Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Send feedback to support@chilkatsoft.com


Software components and libraries for Linux, MAC OS X, IOS (IPhone), Android™, Solaris, RHEL/CentOS
Microsoft Windows 7, Vista, XP, 2000, 2003 Server, 2008 Server, and Windows 95/98/NT4.