Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.js

C# Examples

Async
Certificates
ECC
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
JSON
Jwt
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
REST
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SSH Tunnel
SFTP
Stream
Tar Archive
XML
XMP
Zip

More Examples...
OpenSSL
Google APIs
Google Cloud Storage
Azure Cloud Storage
Amazon S3 (new)
Google Drive
Dropbox
Firebase
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
NTLM
QuickBooks
Spider
Digital Signatures

 

 

 

 

 

 

 

(C#) Send email using SMTP STARTTLS.

Send email using SMTP STARTTLS. With STARTTLS, the SMTP client connects to the SMTP server on port 25 (non-SSL) and then issues a STARTTLS command to convert the connection to a secure TLS channel.

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

Chilkat for Xamarin

//  The mailman object is used for sending and receiving email.
Chilkat.MailMan mailman = new Chilkat.MailMan();

//  Any string argument automatically begins the 30-day trial.
bool success = mailman.UnlockComponent("30-day trial");
if (success != true) {
    Console.WriteLine(mailman.LastErrorText);
    return;
}

//  Set the SMTP server.
mailman.SmtpHost = "smtp.mymailserver.com";

mailman.SmtpUsername = "myLogin";
mailman.SmtpPassword = "myPassword";

mailman.StartTLS = true;

//  Create a new email object
Chilkat.Email email = new Chilkat.Email();

email.Subject = "This is a test";
email.Body = "This is a test";
email.From = "Chilkat Support <support@chilkatsoft.com>";
success = email.AddTo("Chilkat Admin","admin@chilkatsoft.com");

success = mailman.SendEmail(email);
if (success != true) {
    Console.WriteLine(mailman.LastErrorText);
    return;
}

success = mailman.CloseSmtpConnection();
if (success != true) {
    Console.WriteLine("Connection to SMTP server not closed cleanly.");
}

Console.WriteLine("Mail Sent!");

 

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