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

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

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Chilkat WebMail Example: Send an Email with Attachments</TITLE>
</HEAD>
<BODY>

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

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

	' 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
%>
    <br>(View page source to see the log)
    <XML ID="XMLID">
<%
    Response.write mailman.GetInstanceLog()
%>
    </XML>
<%

	' Remove our references.
	Set email = Nothing
	Set mailman = Nothing

%>

</BODY>
</HTML>

 

i


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.