Indy is great, but not well documented so: [WayBack] Indy10, TIdSMTP, how to get protocol log? I try to get log from SMTP communication, like this (copy from wiki): {code} S: 220 smtp.example.com ESMTP P… – Jacek Laskowski – Google+
Q
Indy10, TIdSMTP
, how to get protocol log?
I try to get log from SMTP communication, like this (copy from wiki):
{code}
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
{code}
but without success :-(
I try use many events from TIdSMTP
, TId
LogEvent, TIdSSLIOHandlerSocketOpenSSL
but result is low level like bytes, status etc. not true SMTP log.
How to do it?
A
try
try
IdLogFile.Active := true;
fsmtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(fsmtp);
fsmtp.IOHandler.Intercept := IdLogFile;
fsmtp.IOHandler.OnStatus := fsmtp.OnStatus;
fSMTP.Connect;
fSMTP.Send(fMessage);
except
on e: exception do begin
MessageDlg(‘Error sending message: ‘ + e.Message, mtError, [mbOK], 0);
end;
end;
finally
if fSMTP.Connected then
fSMTP.Disconnect(true);
IdLogFile.Active := false;
end;
+Rik van Kekem Thanks! I need to set
LogEvent.Active: = True
! ;-)
Sending stuff still might be tough, so you might want to consider alternatives too: [WayBack] I need to add to the REST server the ability to send emails with attachments of different types. Which library is best to use? Indy or maybe ICS? Of cou… – Jacek Laskowski – Google+
Q
I need to add to the REST server the ability to send emails with attachments of different types. Which library is best to use? Indy or maybe ICS? Of course with SSL/TLS support.
A

+Balázs Szakály, YES! Synapse. Let’s get people using it more. You can give it some criticism surely, but consider the pro’s:
It is straight-forwardly-written so when you hit a wall you can read the code easily (compared to other solutions),
You can inherit, extend and extrapolate, re-use and tweak,
Very Delphi-ish (TMimeMessages = TStringList or some such, not at at devmachine atm)
Compact and free!
Quite stable too.
–jeroen
Like this:
Like Loading...