Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
Using StartTLS to Send Email over a Secure ConnectionDownload: Chilkat .NET Assemblies How to send email securely over a secure SSL/TLS connection using StartTLS (in C#). // Send email using SMTP StartTLS
// IMPORTANT: Check to make sure your SMTP server supports STARTTLS.
private void button3_Click(object sender, EventArgs e)
{
Chilkat.MailMan mailman = new Chilkat.MailMan();
mailman.UnlockComponent("anything for 30-day trial");
mailman.SmtpHost = "smtp.comcast.net";
// If your SMTP server requires authentication, set your username/password:
mailman.SmtpUsername = "myUsername";
mailman.SmtpPassword = "myPassword";
// The code for using STARTTLS is identical to sending mail over
// an unsecure connection except that you need to set the
// mailman.StartTLS property = true
mailman.StartTLS = true;
Chilkat.Email email = new Chilkat.Email();
email.From = "Matt <matt@chilkatsoft.com>";
email.Subject = "Subject for C# STARTTLS mail programming sample";
email.Body = "Body for C# STARTTLS e-mail example code";
email.AddTo("Email Component Help", "support@chilkatsoft.com");
email.AddFileAttachment("someFile.pdf");
// The SendEmail method will connect to the SMTP server using
// the default (unsecure) port 25. Because StartTLS is true, it will
// negotiate a secure SSL/TLS connection immediately after connecting.
// If authentication is required, it will occur over the secure connection.
// The mail, including all attachments, will be sent over the secure connection also.
bool success = mailman.SendEmail(email);
if (!success)
{
MessageBox.Show(mailman.LastErrorText);
}
else
{
MessageBox.Show("Mail Sent!");
}
}
Important: The download for this
example does not contain the ChilkatDotNet.dll which |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.