Chilkat Examples

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

C# Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GeoOp
Google APIs
Google Cloud Storage
Google Drive
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc

IMAP
JSON
Java KeyStore (JKS)
Jwt
MHT / HTML Email
MIME
NTLM
OAuth1
OAuth2
OpenSSL
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
Socket/SSL/TLS
Spider
Stream
Tar Archive
Twitter
XML
XMP
Xero
Zip
curl

 

 

 

(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.