AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Anhänge aus Email in Text Form extrahieren
Thema durchsuchen
Ansicht
Themen-Optionen

Anhänge aus Email in Text Form extrahieren

Ein Thema von smallsmoker · begonnen am 23. Jan 2009 · letzter Beitrag vom 2. Feb 2009
Antwort Antwort
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#1

Anhänge aus Email in Text Form extrahieren

  Alt 23. Jan 2009, 17:50
Hi ich habe eine email vorliegen also als text mit header etc.
Ich würde nun gerne daraus die enthaltenen anhänge extrahieren ...

hier ein beipiel wie der mir vorliegende text aussieht:

Zitat:
Return-Path: <xxx@gmx.de>
X-Flags: 1001
Delivered-To: GMX delivery to xxx@gmx.de
Received: (qmail invoked by alias); 06 Nov 2005 16:19:04 -0000
Received: from rly-ip06.mx.aol.com (EHLO rly-ip06.mx.aol.com) [64.12.138.10]
by mx0.gmx.net (mx059) with SMTP; 06 Nov 2005 17:19:04 +0100
Received: from smtp-los02.proxy.aol.com (smtp-los02.proxy.aol.com [195.93.24.100])
by rly-ip06.mx.aol.com (8.12.11/8.12.11) with ESMTP id jA6GIrX9004750
for <xxx@gmx.de>; Sun, 6 Nov 2005 11:18:55 -0500
Received: from 172.213.180.16 (ACD5B410.ipt.aol.com [172.213.180.16])
by smtp-los02.proxy.aol.com (8.12.11/8.12.11) with SMTP id jA6GIdUM028667
for <xxx@gmx.de>; Sun, 6 Nov 2005 11:18:44 -0500
Message-Id: <200511061618.jA6GIdUM0286687@smtp-los02.proxy.aol.com>
From: xxx@gmx.de
To: xxx@gmx.de
Subject: xxx
Date: Sun, 6 Nov 2005 17:21:53 +0100
X-Mailer: Microsoft Outlook Express 6.00.2800.1437
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="0903a79e-42a0-49b3-bae7-4556525bd4d6"
X-Scanned-By: MIMEDefang 2.43
X-GMX-Antivirus: -1 (not scanned, may not use virus scanner)
X-GMX-Antispam: 0 (Sender is in whitelist: xxx@gmx.de)
X-GMX-UID: r0kcY8w8eSEkSXHkwHUhaXN1IGRvb4AX

This is a multi-part message in MIME format

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

PEhUTUw+DQ0KPEhFQUQ+DQ0KDQ0KPFNUWUxFPg0NCkE6bGluay B7IGNvbG9yOiBkYXJrYmx1ZTsg
dGV4dC1kZWNvcmF0aW9uOm5vbmU7IH0NDQpBOnZpc2l0ZWQgey Bjb2xvcjogcHVycGxlOyB0ZXh0
LWRlY29yYXRpb246bm9uZTsgfQ0NCkE6aG92ZXIgeyB0ZXh0LW RlY29yYXRpb246dW5kZXJsaW5l
[etc.]
ZSBnaGV0PzxCUj53aGVyZT88QlI+d2hlcmUgMjQ/PEJSPnUgY29taT88QlI+Y29tZSBvbjxCUj50
aGVyZSB1IHI8QlI+d290IHUgZG9pbiBlcmU/PEJSPmZpZ2h0PzwvUD4NDQo8L0JPRFk+DQ0KPC9I
VE1MPg0NCg==

--0903a79e-42a0-49b3-bae7-4556525bd4d6
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--
.
mfg smallsmoker

p.s.: ich gehe diesen umweg da indy 9 die anhänge nicht als solche erkennt vieleicht habt ihr ja auch eine andere idee .. ?
  Mit Zitat antworten Zitat
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#2

Re: Anhänge aus Email in Text Form extrahieren

  Alt 27. Jan 2009, 12:26
push
  Mit Zitat antworten Zitat
Klaus01

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

Re: Anhänge aus Email in Text Form extrahieren

  Alt 27. Jan 2009, 13: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
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#4

Re: Anhänge aus Email in Text Form extrahieren

  Alt 27. Jan 2009, 19:53
Zitat:
...ich gehe diesen umweg da indy 9 die anhänge nicht als solche erkennt...
im ersten thread
  Mit Zitat antworten Zitat
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#5

Re: Anhänge aus Email in Text Form extrahieren

  Alt 2. Feb 2009, 14:35
push

und um meine frage anders zu stellen, gibt es eine fertige komponente in die ich eine email in dieser text form reinstecke und anhänge rausbekomme ?


ot
gibt es eine möglichkeit alle anhänge aus allen emails in outlook zu extrahieren ?
/ot
  Mit Zitat antworten Zitat
nahpets
(Gast)

n/a Beiträge
 
#6

Re: Anhänge aus Email in Text Form extrahieren

  Alt 2. Feb 2009, 15:09
Hallo,

bitte schau mal hier: http://www.delphipraxis.net/internal...t.php?t=151145
Vermutlich hast Du ein ähnliches Problem.

Prinzipiell kann TIdMessage die von die gewünschte Aufgabe erledigen.
  Mit Zitat antworten Zitat
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#7

Re: Anhänge aus Email in Text Form extrahieren

  Alt 2. Feb 2009, 15:15
naja mein programm klappt ja schon nur nich bei den mails die ich laden möchte ...
anscheinend sind die fehlerhaft ... egal ich mach es nun anders (mir outlook und ezdetach)
danke für die mühe
  Mit Zitat antworten Zitat
nahpets
(Gast)

n/a Beiträge
 
#8

Re: Anhänge aus Email in Text Form extrahieren

  Alt 2. Feb 2009, 15:28
Zitat von smallsmoker:
naja mein programm klappt ja schon nur nich bei den mails die ich laden möchte ...
anscheinend sind die fehlerhaft ...
Ja, und genau darum geht es in dem Thread.
Und da steht auch drin, wie man die Fehler eventuell umgehen/beseitigen kann.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:07 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz