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
SMTP SSL for Sending Email
Delphi example source code for connecting to an SMTP server using SSL and sending email. All communications, including authentication, occur over a secure connection. // Sending email over an SMTP SSL connection is achieved // by setting two properties: // 1) The SmtpSsl property = 1 to indicate that an SSL connection should be created. // 2) Set the SmtpPort property = 465, which is the typical port used by SMTP servers for SSL. // procedure TForm1.Button7Click(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'; // Tell the mailman to use SSL ChilkatMailMan21.SmtpSsl := 1; ChilkatMailMan21.SmtpPort := 465; 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.