Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send iso-8859-1 Email VB.NET source code example to send an email using iso-8859-1 characters. Dim success As Boolean = False
' Create a mailman object for sending email.
Dim mailman As New Chilkat.MailMan()
' Any string argument automatically begins the 30-day trial.
mailman.UnlockComponent("30-day trial")
' Set the SMTP server.
mailman.SmtpHost = "smtp.earthlink.net"
' Create an email that uses characters with diacritics (accented characters)
Dim email As New Chilkat.Email()
' Set the basic email stuff: body, subject, "from", "to"
email.Body = "Þ ß à á This is the email body"
email.Subject = "Þ ß à á This is the email subject"
email.AddTo("Þ ß à á", "support@chilkatsoft.com")
email.From = "Þ ß à á <programmer@chilkatsoft.com>"
' Chilkat should automatically recognize this as having characters with diacritics,
' and will by default encode the email as iso-8859-1
' It is possible to verify this by examining the full MIME text of the email:
MessageBox.Show(email.GetMime())
' The MIME that Chilkat generates for this email looks like this:
'
'MIME-Version: 1.0
'Date: Thu, 02 Sep 2004 15:18:45 -0500
'Message-ID: <CHILKAT-MID-d8e999ca-2691-48ef-9e10-abedbbaad1c1@DotNetDev>
'X-Mailer: Chilkat Software Inc (http://www.chilkatsoft.com)
'X-Priority: 3 (Normal)
'Content-Type: text/plain;
' charset="iso-8859-1"
'Content-Transfer-Encoding: quoted-printable
'subject: =?iso-8859-1?Q?=DE_=DF_=E0_=E1_This_is_the_email_subject?=
'To: =?iso-8859-1?Q?=DE_=DF_=E0_=E1?= <support@chilkatsoft.com>
'From: =?iso-8859-1?Q?=DE_=DF_=E0_=E1?= <programmer@chilkatsoft.com>
'return-path: programmer@chilkatsoft.com
'
'=DE =DF =E0 =E1 This is the email body
' To be absolutely sure the email is encoded as iso-8859-1, set the Charset property:
email.Charset = "iso-8859-1"
' One point to remember: Chilkat does not "Q" encode header fields that do not need encoding.
' (i.e. fields that are 7-bit us-ascii already and have no accented (8-bit) characters)
success = mailman.SendEmail(email)
If success Then
MessageBox.Show("Sent email!")
Else
MessageBox.Show(mailman.LastErrorText)
End If
Important: The download for this
example does not contain the ChilkatDotNet.dll which |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.