Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5992931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:36:11+00:00 2026-05-22T23:36:11+00:00

We have a database with stored mbox formatted emails, attachments in their native base64

  • 0

We have a database with stored mbox formatted emails, attachments in their native base64 format in the mailbox format. We can retrieve and access/parse all information…except for the attachments. In short, I can go into MySQL and actually see base64_encoded attachment data, but for whatever reason Mail_mimeDecode() structure shows the attachment portion like this:

[1] => stdClass Object
(
    [headers] => Array
    (
        [content-type] => image/gif; name="image.gif"
        [content-id] => <3243498760_6337281>
        [content-transfer-encoding] => base64
    )

    [ctype_primary] => image
    [ctype_secondary] => gif
    [ctype_parameters] => Array
    (
        [name] => image.gif
    )

    [body] => GIF89ahôÐÐÐðððÙÙ@àààòòÀ   ```000ßß`   PP
)

Any thoughts? Maybe it’s the way I’m storing it, but if that were true, then I wouldn’t be able to see actual base64 data when editing a row in phpMyAdmin. It’s for that reason I’m suspecting something else happening.

Additional Information

  1. I set the collation to: utf8_bin, so
    it’s not case insensitive
  2. I set the
    column type for the stored message
    to longtext, so there’s enough space
    to hold most messages

Updated Information

Adding the flags suggested in the decode() function got me a base64 looking string, but it’s only part of the string. As a test, I tried loading the exact same message from a file called “test.mbox” as opposed to MySQL. The loading via file worked great and showed me everything, but when doing it via MySQL I only see this. It’s like it’s truncating it and only shows one of the attachments (there are two in this message).

[1] => stdClass Object
(
    [headers] => Array
    (
        [content-type] => image/gif; name="image.gif"
        [content-id] => <3243498760_6337281>
        [content-transfer-encoding] => base64
    )

    [ctype_primary] => image
    [ctype_secondary] => gif
    [ctype_parameters] => Array
    (
        [name] => image.gif
    )

    [body] => R0lGODlhaAATAPQAANDQ0PDw8BAQENnZQODg4PLywCAgIGBgYDAwMN/fYKCgoJCQkFBQU
)

…when in actuality, it should look like this (from the “test.box” test I ran):

[1] => stdClass Object
(
    [headers] => Array
    (
        [content-type] => image/gif; name="image.gif"
        [content-id] => <3243498760_6337281>
        [content-transfer-encoding] => base64
    )

    [ctype_primary] => image
    [ctype_secondary] => gif
    [ctype_parameters] => Array
    (
        [name] => image.gif
    )

    [body] => R0lGODZhaAATAPQAANDQ0PDw8BAQENnZQODg4PLywCAgIGBgYDAwMN/fYKCgoJCQkFBQUHBw
cObmgM/PEPz88LCwsPn54ZzsoPb20O/vsICAgEBAQMDAwMzMAAAAAP///wAAAAAAAAAAAAAA
ACH/C01TT0ZGSUNFOS4wGAZAAAxtc09QTVNPRkZJQ0U5LjAgJPn1cgAh/wtNU09GRklDRTku
MBgAAAAMY21QUEpDbXAwNzEyZAAAA0gAc7wALAAAAABoABMAAAX/4CaOZGmeJIYRKElgQCvP
Y6DSeC5jmnbRl55uKLL0MMQkjucjWSyKUlCTegaUJqMGie2amL9RLzxqXMibKde70a7ZXjBp
DDzC2/ahpMDv+wsSJgAqhDcjchsqPZgqMRuDXC8IPQuGNiskkCWFGAd5IpCEjiQOGaanqBkD
JlM9rggsiXQbrrVhU0W1rkhMFiRTjgACursiAZPEBxs2ACwJqamrUsQ9DCKI1LdCeMS8Pb4j
aiIG1HmtxDEWAmHPqQ+m0iQRT/QMrtezCloGT1y4jxbIaThgYcGVXr/sMOFHDxkXV/TU2SEA
YFQ7VRVKqZqxoBa+JmJAhtsmQtyhbwm3/8gSye3htgCtYplIMKDABgjvNqIIYM/jSjSzRlIR
+gYh0Z9O8tzDMKxHFBoadQoS6BORiKZlSab5tBJcVpVWW16l5ErAmxY4T8Uj0bGH2XtIQ6LZ
OvRrUZSgmnoTSUCgS1tXcExAtVaEpzFX4IbFSjflXQ3g2iqcFaGpSlq1vOa4WBgAxJBDF7Ns
fPQkZJ669v5okHqsBrNK2hVeSI/1NtGQoXwlcZiBlZUIqOpdKQDZa6U9CEa0EJjGs9nlbmOl
CvKfCAWtmZTFYNKyUzeGo5+VQdOEcV1hmFgbAYCqtroibNvx7OrCFWDXm15IlyfA4W5DUHBC
KIWkgEFz7KkQyxcLo9TQyAgvwAChhJnIdEkJlxTS4AYhAAA7
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:36:11+00:00Added an answer on May 22, 2026 at 11:36 pm

    Surprise! Mail_mimeDecode actually, well, I hesitate to say it, decodes the attachment.

    BTW: longtext holding most email messages is an understatement I hope, that’s 4GB, would hate to receive a mail bigger than that 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I host an application in Windows Azure and have the database stored on
I've got an MS-Access database stored in a folder (yes, I have 'Modify' permissions
I have sql database stored on a shared netwrok drive , after set of
I have a very odd issue. When I execute a specific database stored procedure
I have a database which contains picture data stored as a binary blob. The
I have a database with DateTime fields that are currently stored in local time.
We have a large database containing a lot of stored procedures. Now we are
I have a setting stored in database which has a value .jpg|.gif|.png . I
I have a huge database with 100's of tables and stored procedures. Using SQL
I have a huge database with some 100 tables and some 250 stored procedures.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.