Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Delphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVBScript

C# Examples

Certificates
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
MHT / HTML Email
POP3
RSA Encryption
MIME
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Tar Archive
XML
XMP
Zip

More Examples...
Amazon S3
Bounced Email
CSV
Diffie-Hellman
NTLM

 

 

 

 

 

 

 

Using StartTLS to Send Email over a Secure Connection

Download: 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
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

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