Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Sending Mail with STARTTLS
Delphi sample code showing how to use STARTTLS when sending email with the Chilkat email component. // Some SMTP servers do not accept SSL connections on port 465, but instead // accept normal non-SSL connections on the standard SMTP port 25, but then // respond to a STARTTLS command to convert the connection to a secure SSL/TLS connection. // The Chilkat mail component handles this entirely. You only need to indicate // that you want STARTTLS by setting the mailman's StartTLS property = 1. // procedure TForm1.Button8Click(Sender: TObject); var email: IChilkatEmail2; ok: Integer; begin // A ChilkatMailMan2 ActiveX component was dropped onto the Delphi // form, and this became the Form's member variable "ChilkatMailMan21". ChilkatMailMan21.UnlockComponent('Anything for 30-day trial'); ChilkatMailMan21.SmtpHost := 'smtp.comcast.net'; // If our SMTP server requires authentication, set the username/password. ChilkatMailMan21.SmtpUsername := 'myUsername'; ChilkatMailMan21.SmtpPassword := 'myPassword'; // Indicate that you want StartTLS: // With STARTTLS, all communications including authentication and the mail sending, // are transmitted over a secure SSL/TLS channel. ChilkatMailMan21.StartTLS := 1; email := ChilkatMailMan21.NewEmail(); email.Subject := 'Email sent from a Delphi program!'; email.From := 'Chilkat Support <support@chilkatsoft.com>'; email.AddTo('Chilkat Admin','admin@chilkatsoft.com'); email.Body := 'This email was mailed from a Delphi program...'; // Connect to the SMTP server and send the email. ok := ChilkatMailMan21.SendEmail(email); if (ok = 0) then ChilkatMailMan21.SaveLastError('errorLog.xml'); end;
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.