C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

Mail an HTML Web Page in C#

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

How to mail a Web Page in C#

This is an example demonstrating how to create an email from a Web page and send it in C#.

// Download a Web page including all associated images and style sheets,
// create a self-contained email, and send it.
private void MailWebPage_Click(object sender, System.EventArgs e)
{
	// Chilkat MHT .NET is used to download and create the email.
	Chilkat.Mht mht = new Chilkat.Mht();
	mht.UnlockComponent("mhtUnlockCode");

	// Chilkat Email .NET is used to send the email.  
	// It is a separate product and needs a separate unlock code.
	Chilkat.MailMan mailman = new Chilkat.MailMan();
	mailman.UnlockComponent("mailUnlockCode");

	// Get the email.
	Chilkat.Email email = mht.GetEmail("http://www.google.com");

	// The Google page is utf-8, so let's convert the HTML in our
	// email to iso-8859-1.  We do this simply by setting the HtmlCharset
	// property.
	email.HtmlCharset = "iso-8859-1";

	// Fill out the remainder of the email.
	email.Subject = "This is the Google home page";
	email.AddTo("Matt","matt@chilkatsoft.com");
	email.From = "Chilkat Sales <sales@chilkatsoft.com>";

	// You may or may not need an SMTP username/password.
	mailman.SmtpHost = "smtp.earthlink.net";
	//mailman.SmtpUsername = "myLogin";
	//mailman.SmtpPassword = "myPassword";

	bool success = mailman.SendEmail(email);
	if (!success)
	{
		textBox1.Text = mailman.LastErrorXml;
	}
	else
	{
		textBox1.Text = "Mail Sent!";
	}

}

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser