Hi, I use Lazarus 1.6.2 r53354 FPC 3.0.0 i386-win32,and SYNAPSE (V
002.006.000)
I can successfully connect to the Gmail account, download all unread emails
and attachments.
How do I access the BODY of the email?
For instance, I have an email where the body only contains these three
lines:
Stefan's Body Line 1
Stefan's Body Line 2
Stefan's Body Line 3
This is the in the code that Iuse to write the BODY part:
Memo1.Lines.AddStrings(MimeMess.MessagePart.Lines);
It writes something like this (this is just a part of it):
--047d7bfcfdb0b21b400544c9c4fb
Content-Type: multipart/alternative; boundary=047d7bfcfdb0b21b390544c9c4f9
--047d7bfcfdb0b21b390544c9c4f9
Content-Type: text/plain; charset=UTF-8
Stefan's Body Line 1
Stefan's Body Line 2
Stefan's Body Line 3
--047d7bfcfdb0b21b390544c9c4f9
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
​Here is the part of the code with the issue:
for j:=1 to cnt do
begin
imap.FetchMess(j,MimeMess.Lines);
MimeMess.DecodeMessage;
// WRITE HEADER STUFF
Memo1.Lines.Add('From: ' + MimeMess.Header.From);
spcnt:=MimeMess.MessagePart.GetSubPartCount();
if spcnt>0 then // there are attachments
for cnt:=0 to spcnt-1 do
begin
MimePart:=MimeMess.MessagePart.GetSubPart(cnt);
MimePart.DecodePart;
// SAVE ATTACHMENTS
Memo1.Lines.Append(MimePart.Primary+' ;
'+MimePart.Secondary+' ; Attachment: '+MimePart.Filename);
setlength(s,MimePart.DecodedLines.Size);
MimePart.DecodedLines.Read(s[1],length(s));
MimePart.DecodedLines.SaveToFile(MimePart.Filename);
end;
// SAVE THE BODY
Memo1.Lines.AddStrings(MimeMess.MessagePart.Lines); *<< PROBLEM
IS HERE*
end;
Thank you.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public