I'm using this library to get my exchange journaling mails from gmail into my MySQL database. It works like a charm, except the message body decoding of Multipart base64 mails. How can I solve this problem and get a readable message from it ?
For example, such a message body is saved in my database table:
Sender: [email protected]
Subject: Jobanfrage
Message-Id: F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80@AMSPRD0610MB373.eurprd06.prod.outlook.com
To: [email protected]
--000_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
SGFsbG8gTGluZSwNCg0KSW0gQW5oYW5nIGRpZXNlciBFbWFpbCBzZW5kZSBpY2ggZGlyIGRlaW5l...cutted base64...
--000_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
PGh0bWwgeG1sbnM6dj0idXJuOnNjaGVtYXMtbWljcm9zb2Z0LWNvbTp2bWwiIHhtbG5zOm89InVy
bjpzY2hlbWFzLW1pY3Jvc29mdC1jb206b2ZmaWNlOm9mZmljZSIgeG1sbnM6dz0idXJuOnNjaGVt...cutted base64....
--000_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373--
--009_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: image/jpeg; name="image001.jpg"
Content-Description: image001.jpg
Content-Disposition: inline; filename="image001.jpg"; size�53;
creation-date="Thu, 22 Aug 2013 08:17:17 GMT";
modification-date="Thu, 22 Aug 2013 08:17:17 GMT"
Content-ID: [email protected]
Content-Transfer-Encoding: base64
/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABQAAD/7QAsUGhvdG9z
aG9wIDMuMAA4QklNBCUAAAAAABAAAAAAAAAAAAAAAAAAAAAA/+4ADkFkb2JlAGTAAAAAAf/bAIQA...cutted base64...
--009_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: image/png; name="image002.png"
Content-Description: image002.png
Content-Disposition: inline; filename="image002.png"; size52;
creation-date="Thu, 22 Aug 2013 08:17:17 GMT";
modification-date="Thu, 22 Aug 2013 08:17:17 GMT"
Content-ID: [email protected]
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAhFBMVEUAAAAAFVAAGFIAG1UDHlcH
IVoKJFwNKF8PKFwRKV0RK2ETK18ULmQVLWAXMWYbNGkeN2tDXppGYp1KZqBLZJpOaaJSbaVWcKhX
cKJYcqRadKtddqled65heq1he61he7BifLBifLFlf7NphbdqgLFsgrNwhrJxjrxzibl6lsLQ2Ovi
6PZj+2o5AAAAEXRSTlMAv7+/v7+/v7+/v7+/v7+/v/mxPx0AAAB6SURBVBgZBcHRSkJhEAbA+Y8b
hgQFBdr7v5xQFyFBHXL3a2Z5AQBf9fwOAFKZP2D2OD2k5t7A8bR8r6mZBmrR21TvgKVv9q40aHw6
SCXgjLMPqQQAkcqAq4srUgmAIJUACFJPbwF4Zd1r9gaOfjhMTTbgZiOzPAKA33+ZjUAYiPBBrwAA
AABJRU5ErkJggg=
--009_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: image/png; name="image003.png"
Content-Description: image003.png
Content-Disposition: inline; filename="image003.png"; sizeY4;
creation-date="Thu, 22 Aug 2013 08:17:17 GMT";
modification-date="Thu, 22 Aug 2013 08:17:17 GMT"
Content-ID: [email protected]
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACGUlEQVR42p2RXUhTYRjH34iIbrot
y4bTaVku11GyIX1LMMIiuml9XBZ002U3MaQ0xGoJmh7GEqHIEcaRiMyM9UaWs0RQm2W4tpHbWjCI..cutted base64...
--009_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: image/jpeg; name="image004.jpg"
Content-Description: image004.jpg
Content-Disposition: inline; filename="image004.jpg"; sizeY24;
creation-date="Thu, 22 Aug 2013 08:17:17 GMT";
modification-date="Thu, 22 Aug 2013 08:17:17 GMT"
Content-ID: [email protected]
Content-Transfer-Encoding: base64
/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABQAAD/7gAOQWRvYmUA
ZMAAAAAB/9sAhAACAgICAgICAgICAwICAgMEAwICAwQFBAQEBAQFBgUFBQUFBQYGBwcIBwcGCQkK...cutted base64...
--009_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373--
--000_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
SGFsbG8gTGluZSwNCg0KSW0gQW5oYW5nIGRpZXNlciBFbWFpbCBzZW5kZSBpY2ggZGlyIGRlaW5l
IEVpbnNhdHp2ZXJlaW5iYXJ1bmcgbWl0IGFsbGVuIHdpY2h0aWdlbiBJbmZvcm1hdGlvbmVuIHp1...cutted base64...
--000_F03EB7C5ACB6624CB754CC1D8D3371EC5C989C80AMSPRD0610MB373
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
PGh0bWwgeG1sbnM6dj0idXJuOnNjaGVtYXMtbWljcm9zb2Z0LWNvbTp2bWwiIHhtbG5zOm89InVy
bjpzY2hlbWFzLW1pY3Jvc29mdC1jb206b2ZmaWNlOm9mZmljZSIgeG1sbnM6dz0idX...cutted base64...