Einzelnen Beitrag anzeigen

Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.779 Beiträge
 
Delphi 10.4 Sydney
 
#3

Re: Anhänge aus Email in Text Form extrahieren

  Alt 27. Jan 2009, 14:03
Code:
This is a multi-part message in MIME format

--0903a79e-42a0-49b3-bae7-4556525bd4d6    <-- Marker
Content-Type: application/octet-stream; charset=iso-8859-1; name=xyz.html
Content-Transfer-Encoding: base64                               <-- Encoding Type
Content-Disposition: attachment; filename="xyz.html"

PEhUTUw+DQ0KPEhFQUQ+DQ0KDQ0KPFNUWUxFPg0NCkE6bGluayB7IGNvbG9yOiBkYXJrYmx1ZTsg
dGV4dC1kZWNvcmF0aW9uOm5vbmU7IH0NDQpBOnZpc2l0ZWQgeyBjb2xvcjogcHVycGxlOyB0ZXh0 
LWRlY29yYXRpb246bm9uZTsgfQ0NCkE6aG92ZXIgeyB0ZXh0LWRlY29yYXRpb246dW5kZXJsaW5l
[etc.]
ZSBnaGV0PzxCUj53aGVyZT88QlI+d2hlcmUgMjQ/PEJSPnUgY29taT88QlI+Y29tZSBvbjxCUj50 
aGVyZSB1IHI8QlI+d290IHUgZG9pbiBlcmU/PEJSPmZpZ2h0PzwvUD4NDQo8L0JPRFk+DQ0KPC9I
VE1MPg0NCg==

--0903a79e-42a0-49b3-bae7-4556525bd4d6 <--- Marker
Content-Type: text/plain; charset=iso-8859-1 
Content-Transfer-Encoding: quoted-printable


Das ist der Text der Nachricht

blablabla
--0903a79e-42a0-49b3-bae7-4556525bd4d6--  <--Marker
In der Nachricht steht doch wie sie Kodiert ist.
Base64, Du brauchst den Teil doch nur wieder zurückverwandeln.

[edit]

Warum nutzt Du nicht TidPop3.retrieve?
Retrieves a message by number.

function Retrieve(const MsgNum: Integer; AMsg: TIdMessage): Boolean;

Parameters

const MsgNum: Integer

Message number to retrieve from the server.

AMsg: TIdMessage

Message instance where the values will be stored.

Returns

Boolean - True on success.


Description

Retrieve is a Boolean function that retrieves the message number passed as the argument and stores the result in a IdMessage component, with MIME decoding. An IdText object is created for any text parts the message has and an IdAttachment for the attachments.


Aus der TidMessage kannst Du doch dann alles auslesen:
List of message parts for the message.


property MessageParts: TIdMessageParts;

Description

MessageParts is a TIdMessagePartsList used to store the TIdMessagePart components that make up the message. MessageParts can contain two TIdMessagePart descendants: TIdText and TIdAttachment.
MessageParts is used when IsEncoded is set to True (on sending), or NoDecode is set to false for receiving.


Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat