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 with File Attachments

This example demonstrates how to create an Email programmatically, attach two files, and send it.

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: Send an Email with Attachments</TITLE>
</HEAD>
<BODY>

<%
	' Create a mailman.  The mailman can send and receive Emails.
	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 = "www.somedomain.com"

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

	' Enter the recipient's information
	email.AddTo "Michael Johnson", "michael.johnson@somedomain.com"

	' Enter the sender's information
	email.FromName = "Joe Smith"
	email.FromAddress = "joe.smith@somedomain.com"

	' Enter the email subject
	email.Subject = "Important News"

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

	' The attachments are added to the email object here.
	email.AddFileAttachment("C:\SampleData\sample.pdf")
	email.AddFileAttachment("C:\SampleData\sample.jpg")

	' 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

	' Remove our references.
	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.