Quoted-Printable kodierter Anhang aus E-Mail extrahieren
Hallo Java Entwickler,
ich habe E-Mails im Textformat (eml) vorliegen, in denen PDF-Dateien als Anhang gespeichert sind.
Der PDF-Anhang ist nicht Base64, sondern quoted-printable kodiert (Content-Transfer-Encoding: quoted-printable).
Im Falle Base64 habe ich eine funktionierende Lösung:
Nun suche ich statt einem BASE64Decoder einen QuotedPrintableDecoder - bin aber nicht fündig geworden.
Gibt es eine Lösung (die ähnlich einfach ist wie oben)?
vG
LS
ich habe E-Mails im Textformat (eml) vorliegen, in denen PDF-Dateien als Anhang gespeichert sind.
Der PDF-Anhang ist nicht Base64, sondern quoted-printable kodiert (Content-Transfer-Encoding: quoted-printable).
Im Falle Base64 habe ich eine funktionierende Lösung:
private void writeBase64toFile(String base64, String dateiName) {
BASE64Decoder myDecoder = new BASE64Decoder();
File fo;
try {
// base64-Text --> Bytes
byte decoded = myDecoder.decodeBuffer(base64);
// Datei speichern
FileOutputStream fos = null;
fos = new FileOutputStream(dateiName);
fos.write(decoded);
fos.close();
} catch (Exception e) {
// ...
}
}
Nun suche ich statt einem BASE64Decoder einen QuotedPrintableDecoder - bin aber nicht fündig geworden.
Gibt es eine Lösung (die ähnlich einfach ist wie oben)?
vG
LS
Please also mark the comments that contributed to the solution of the article
Content-Key: 293076
Url: https://administrator.de/contentid/293076
Printed on: April 19, 2024 at 11:04 o'clock
1 Comment
Moin,
guckst du hier:
https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commo ...
Gruß jodel32
guckst du hier:
https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commo ...
Gruß jodel32