Lazarus

Programming => Networking and Web Programming => Topic started by: pcurtis on October 20, 2021, 02:04:36 pm

Title: [CLOSED] Can't get email header (subject) from icloud using synapse
Post by: pcurtis on October 20, 2021, 02:04:36 pm
I use this to connect to iclouds imap server,

Code: Pascal  [Select][+][-]
  1. procedure TForm1.CheckMail(aUsername : String; aPassword : String; aServer : String);
  2. var
  3.   imap : TIMAPSend;
  4.    MimeMess : TMimeMess;
  5. begin
  6.   Application.ProcessMessages;
  7.   imap := TIMAPSend.create;
  8.   MimeMess := TMimeMess.Create;
  9.   MimeMess.Header.CharsetCode := UTF_8;
  10.  
  11.   imap.FullSSL := true;
  12.   imap.Username:=aUsername;
  13.   imap.Password:=aPassword;
  14.   imap.TargetHost:=aServer;
  15.   imap.TargetPort := '993';
  16.   imap.Timeout := 2000;
  17.  
  18.   if imap.login then
  19.     begin
  20.       imap.SelectFolder('INBOX');
  21.  
  22.        imap.FetchMess(20, MimeMess.Lines);  //yes the message exists and has a subject
  23.        
  24.         MimeMess.DecodeMessage;
  25.         ShowMessage(MimeMess.Header.Subject);
  26.         ..........
  27.  

The login is OK, but fetching a mail always returns empty headers.

Any ideas?
Title: Re: Can't get email header (subject) from icloud using synapse
Post by: pcurtis on October 20, 2021, 05:58:49 pm
Don't know what I've done but it works now

Ok, fetchmessage only gets the body on icloud, on other servers it gets headers + body
TinyPortal © 2005-2018