Recent

Author Topic: [CLOSED] Can't get email header (subject) from icloud using synapse  (Read 861 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 742
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?
« Last Edit: October 20, 2021, 05:59:43 pm by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

pcurtis

  • Hero Member
  • *****
  • Posts: 742
Re: Can't get email header (subject) from icloud using synapse
« Reply #1 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
« Last Edit: October 20, 2021, 06:07:48 pm by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

 

TinyPortal © 2005-2018