Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
STARTTLS Send E-Mail Sample Code Sending email over a secure channel using STARTTLS is identical to sending email w/out STARTTLS. The only difference is that we set the mailman.StartTLS property = true. When the mailman sends email, it will first connect to the SMTP server via the normal unsecure port 25. It will then issue a STARTTLS command to make the channel secure, login, and send the email. Both the login (if necessary) and mail sending are over the secure channel. Dim mailman As New Chilkat.MailMan()
mailman.UnlockComponent("Anything for 30-day trial")
mailman.SmtpHost = "smtp.comcast.net"
mailman.StartTLS = True
Dim email As New Chilkat.Email
email.AddTo("Chilkat Support", "support@chilkatsoft.com")
email.AddTo("Chilkat Sales", "sales@chilkatsoft.com")
email.From = "Matt Fausey <fausey@chilkatsoft.com>"
email.Subject = "This is a test"
email.SetHtmlBody("<html><body><h1>This is a test</h1><p>Hello World!</p></body></html>")
Dim success As Boolean
success = mailman.SendEmail(email)
If (Not success) Then
MessageBox.Show(mailman.LastErrorText)
Else
' Show the LastErrorText anyway, because is will include
' informational messages and we can verify for testing that the
' StartTLS actually happened.
' You will see this message: "Error authenticating server credentials",
' which can be ignored.
MessageBox.Show(mailman.LastErrorText)
End If
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.