Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

Email SMTP .NET Component .NET SMTP / POP3 Email Component

ASP.NET SMTP Send Example Source Code Snippets

The full source code for these examples are provided in the ChilkatDotNet.msi download at http://www.chilkatsoft.com/downloads.asp

ASP.NET SMTP: Convert the Yahoo! Home Page into an HTML Email and Send

    '=======================================================================================
    '
    ' Example 3
    '
    ' Send Yahoo! home page as an HTML email
    '
    ' This is easy.  We can use the basic "Lite" functionality in Chilkat MHT
    ' to create an HTML email with all the embedded images directly from a URL.
    ' You could also do the same for an HTML file.
    '=======================================================================================

    ' 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"))


    ' 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

 

Copyright 2000-2005 Chilkat Software, Inc. All rights reserved.
Components for Microsoft Windows XP, 2000, NT, 95/98/ME