Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TIdSMTP and protocol log, how?


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Feb 28, 2018 8:49 AM Last Post By: Remy Lebeau (Te...
Jacek Laskowski

Posts: 37
Registered: 8/8/10
TIdSMTP and protocol log, how?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 27, 2018 2:25 PM
I try to get log from SMTP communication, like this (copy from wiki):

S: 220 smtp.example.com ESMTP Postfix
C: HELO relay.example.com
S: 250 smtp.example.com, I am glad to meet you
C: MAIL FROM:<bob@example.com>
S: 250 Ok
C: RCPT TO:<alice@example.com>
S: 250 Ok
C: RCPT TO:<theboss@example.com>
S: 250 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: "Bob Example" <bob@example.com>
C: To: Alice Example <alice@example.com>
C: Cc: theboss@example.com
C: Date: Tue, 15 January 2008 16:02:43 -0500
C: Subject: Test message


but without success :-(

I try use many events from TIdSMTP, TIdLogEvent, TIdSSLIOHandlerSocketOpenSSL but result is low level like bytes, status etc. not true SMTL log.

How to do it?

Edited by: Jacek Laskowski on Feb 28, 2018 7:53 AM
Jacek Laskowski

Posts: 37
Registered: 8/8/10
Re: TIdSMTP and protocol log, how?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 3:08 AM   in response to: Jacek Laskowski in response to: Jacek Laskowski
I try this:

  fSMTP := TIdSMTP.Create(nil);
  fSSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  fSMTPLog := TIdLogEvent.Create(nil);
  fSMTPLog.OnStatus := OnLogEventStatus;
  fSMTPLog.OnReceived := OnLogEventReceived;
  fSMTPLog.OnSent := OnLogEventSent;
 
  fSMTP.IOHandler := fSSL;
  fSMTP.Intercept := fSMTPLog;


but OnReceived, OnSent and OnStatus events are never called! Why?
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: TIdSMTP and protocol log, how?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 8:49 AM   in response to: Jacek Laskowski in response to: Jacek Laskowski
Jacek Laskowski wrote:

I try this:
<snip>
but OnReceived, OnSent and OnStatus events are never called! Why?

You did not set the TIdLogEvent's Active property to True:

fSMTPLog.Active := True;


--
Remy Lebeau (TeamB)
Jacek Laskowski

Posts: 37
Registered: 8/8/10
Re: TIdSMTP and protocol log, how?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2018 3:54 AM   in response to: Jacek Laskowski in response to: Jacek Laskowski
Arggh...

I need to set Log.Active: = True!

I did not guess it because I don't use designtime, I only create controls in runtime.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02