I have been fooling about with the SMTP client and server components in Indy 9 using demos with Delphi 7. Everything works fine. However, when I telnet into the server, the demo shows only the email subject and mail body, the From:
and To:
fields are not shown.
The code below shows that AMsg
is lacking the relevant data.
procedure TForm1.IdSMTPServer1ReceiveMessageParsed(ASender: TIdCommand;
var AMsg: TIdMessage; RCPT: TIdEMailAddressList;
var CustomError: String);
begin
// This is the main event if you have opted to have the idSMTPServer to do your parsing for you.
// The AMessage contains the completed TIdMessage.
// NOTE: Dont forget to add IdMessage to your USES clause!
ToLabel.Caption := AMsg.Recipients.EMailAddresses;
FromLabel.Caption := AMsg.From.Text;
SubjectLabel.Caption := AMsg.Subject;
Memo1.Lines := AMsg.Body;
// Implement your file system here :)
end;
Can anybody suggest a reason? First of all, a thankyou to Remy for his response. Second, it seems I can't post images here, yet, but here is a link to images of server-telnet session https://postimg.org/image/f0n9j0kcx/. The telnet session shows the server responses. Thanks also for reminding me about Wireshark, and the suggestion of using a TIdLog component.