'=======================================================================================
'
' Example 4
'
' Send Yahoo! home page using mail-merge
'
' We'll do the same as with the Yahoo! home page, but we'll replace
' all occurances of "Yahoo" with "Chilkat"
'=======================================================================================
' Create a Chilkat.MailMan object for sending,
' and set the necessary properties and unlock the component.
Dim mailman as New Chilkat.MailMan()
mailman.UnlockComponent(Request.form("unlockCode"))
' Tell the MailMan the SMTP server to be used for sending email.
mailman.SmtpHost = Request.form("smtpServer")
' Optionally provide the SMTP server with a login and password.
' The MailMan will automatically choose the most secure SMTP authorization
' method available.
if Request.form("smtpLogin") <> "" then
mailman.SmtpUsername = Request.form("smtpLogin")
mailman.SmtpPassword = Request.form("smtpPassword")
end if
' Create an Email object. The mailman will send the email.
Dim email As New Chilkat.Email()
' Give our email a subject, recipient, and return address.
email.From = Request.form("fromAddr")
email.AddTo("",Request.form("recipient"))
email.Subject = "Chilkat ASP.NET " + Request.form("exampleSelected")
Dim mht as New Chilkat.Mht
mht.UnlockComponent(Request.form("unlockCode"))
email = mht.GetEmail("http://www.yahoo.com/")
' Give our email a subject, recipient, and return address.
email.From = Request.form("fromAddr")
email.AddTo("",Request.form("recipient"))
' Replace all occurances of "Yahoo" with "Chilkat"
email.SetReplacePattern("Yahoo","Chilkat")
' Connect to the SMTP server and send mail.
if (mailman.SendEmail(email)) then
Response.write("Mail sent!")
else
Response.write("Errors in sending email!")
Response.write(mailman.LastErrorHtml)
end if
|