02-28-2019, 04:40 PM
(This post was last modified: 03-01-2019, 06:31 PM by rlebeau.
Edit Reason: formatting
)
When I add TIdMessageParts, TIdText, and TIdAttachment to the uses clause, Delphi 10.3 flags them as unknown identifiers.
Sorry, I did not include all the code..... just the parts Delphi 10.3 complained about. Here is the actual code:
Sorry, I did not include all the code..... just the parts Delphi 10.3 complained about. Here is the actual code:
Code:
EmailCount := Pop3.CheckMessages; // How many emails are waiting
for Idx:= 1 to EmailCount do
begin
for Jdx := 1 to 50 do
App_Products[Jdx] := '';
EmailMsg.Clear;
Pop3.Retrieve(Idx,EmailMsg);
Subject := EmailMsg.Subject;
if (Pos('New Shop Order from App!', Subject) = 0) or (Subject = '') then
continue;
Header := EmailMsg.Headers.Text;
Jdx := Pos('Message-ID', Header);
Order_ID := Copy(Header, Jdx + 13, 100);
Jdx := Pos('@', Order_ID);
SetLength(Order_ID, Jdx - 1);
if not New_Order then
continue;
From := EmailMsg.From.Address;
FromText := EmailMsg.From.Text;
ToWhom := EmailMsg.Recipients.EMailAddresses;
if ToWhom = '' then continue;
Date_Str := FormatDateTime('dd mmm yyyy hh:mm:ss', EmailMsg.Date);
App_entry := 0;
App_Receipt := Get_Next_Seq('APPORDER');
for Jdx := 0 to Pred(EmailMsg.MessageParts.Count) do
begin
if (EmailMsg.MessageParts.Items[Jdx] is TIdAttachment) then
begin //general attachment
pnlAttachments.visible := true;
li := lvMessageParts.Items.Add;
li.ImageIndex := 8;
li.Caption := TIdAttachment(Msg.MessageParts.Items[Jdx]).Filename;
li.SubItems.Add(TIdAttachment(Msg.MessageParts.Items[Jdx]).ContentType);
end
else
begin //body text
if EmailMsg.MessageParts.Items[Jdx] is TIdText then
begin
Parse[Jdx] := EMailMsg.TIdText(EmailMsg.MessageParts.Items[Jdx]).Body;
if Jdx = 1 then
begin
Parse_Order;
Body := Parse[Jdx].Text;
end;
end;
end;
end;
