|

DOWNLOAD
Reference
ASP Examples
Visual Basic Examples
Chilkat Mail 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.
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.
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Chilkat Mail Example: Mail Merge</TITLE>
</HEAD>
<BODY>
<%
' Create a mailman
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 = "localhost"
' Create an Email message
set email = Server.CreateObject("ChilkatMail.ChilkatEmail")
' 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 4.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
' Standard ASP cleanup of objects
Set email = Nothing
Set mailman = Nothing
%>
</BODY>
</HTML>
|
|
Privacy
Statement. Copyright 2000-2008 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.
|
|