![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi ActiveX) SMTP InspectionSee more SMTP ExamplesExamine an SMTP session to view all communications sent to the SMTP server.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB; ... procedure TForm1.Button1Click(Sender: TObject); var success: Integer; mailman: TChilkatMailMan; email: TChilkatEmail; mimeStr: WideString; begin success := 0; mailman := TChilkatMailMan.Create(Self); mailman.SmtpHost := 'smtp.example.com'; mailman.SmtpUsername := 'myUsername'; mailman.SmtpPassword := 'myPassword'; mailman.SmtpPort := 465; mailman.StartTLS := 1; email := TChilkatEmail.Create(Self); email.Subject := 'This is a test'; email.Body := 'This is a test'; email.From := 'Alex <alex@example.com>'; email.AddTo('Christoph','christoph@example2.com'); email.AddBcc('Victor','victor@example3.com'); // Generate the MIME that is sent when SendEmail is called mimeStr := mailman.RenderToMime(email.ControlInterface); Memo1.Lines.Add(mimeStr); success := mailman.SendEmail(email.ControlInterface); if (success = 0) then begin Memo1.Lines.Add(mailman.LastErrorText); Exit; end; success := mailman.CloseSmtpConnection(); if (success <> 1) then begin Memo1.Lines.Add('Connection to SMTP server not closed cleanly.'); end; // Examine the SMTP session log. Memo1.Lines.Add('----'); Memo1.Lines.Add('Smtp Session Log:'); Memo1.Lines.Add(mailman.SmtpSessionLog); // --------------------------------------------------- // Sample output: // --------------------------------------------------- // MIME-Version: 1.0 // Date: Fri, 06 Mar 2026 16:21:00 -0600 // Message-ID: <A5DC25990C93EC2676F4FBB2BB3BFA9EB34FF9D3@CHILKAT25> // Content-Type: text/plain; charset=us-ascii; format=flowed // Content-Transfer-Encoding: 7bit // X-Priority: 3 (Normal) // Subject: This is a test // From: Alex <alex@example.com> // To: Christoph <christoph@example2.com> // Bcc: Victor <victor@example3.com> // // This is a test // ---- // Smtp Session Log: // 220 smtp.example.com ESMTP Amazon WorkMail SMTP Service // EHLO MYCOMPUTER<CRLF> // 250-smtp.example.com // 250-8BITMIME // 250-AUTH PLAIN LOGIN // 250 Ok // AUTH LOGIN<CRLF> // 334 VXNlcm5hbWU6 // YWRtaW5AY2hpbGthdHNvZnQuY29t<CRLF> // 334 UGFzc3dvcmQ6 // {PasswordOrCredentials} // 235 Authentication successful. // MAIL FROM:<alex@example.com><CRLF> // 250 Ok // RCPT TO:<christoph@example2.com><CRLF> // 250 Ok // RCPT TO:<victor@example3.com><CRLF> // 250 Ok // DATA<CRLF> // 354 End data with <CR><LF>.<CR><LF> // {388 bytes} <--- The MIME source of the email (examined via RenderToMime) was sent here. // <CRLF>.<CRLF> // 250 Ok // QUIT<CRLF> // 221 Bye end; |
||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.