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() ' Any string passed to UnlockComponent automatically begins a 30-day trial. Dim success As Boolean success = mailman.UnlockComponent("Hello World") If (success <> true) Then MsgBox(mailman.LastErrorText) Exit Sub End If 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>") 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-2010 Chilkat Software, Inc. All Rights Reserved.