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 8364277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:23:42+00:00 2026-06-09T12:23:42+00:00

I am reading imap email with PHP and downloading attachments, using the core imap

  • 0

I am reading imap email with PHP and downloading attachments, using the core imap PHP functions. I am also connecting via the imap protocol (not POP). I would like to be able to know the filesize of attachments before I load them into memory, to reduce server resource usage.

For example I want a limit of 5mb per attachment, this way I can discard any attachments that are over the limit, before they consume any server resources. Finding the size of the email might help but the problem with that is I want the limit per attachment, not per email.

imap_fetchbody() is loading the attachment, which all works. I could probably read the size of the result of that function but that would mean loading the attachment into memory first.

Thanks

  • 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-06-09T12:23:44+00:00Added an answer on June 9, 2026 at 12:23 pm

    I realize this is an older post, but in case it helps, the difference in size is due to the attachments being base64-encoded, which results in a roughly 33% expansion of the data. From RFC3501: "[Body size is] A number giving the size of the body in octets. Note that this size is the size in its transfer encoding and not the resulting size after any decoding."

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

Sidebar

Related Questions

I've been battling PHP's email reading functions for the better part of two days.
If reading and parsing email from via Pop is a critical part of my
I'm not sure I'm using glDrawTex_OES correctly. In fact, I'm sure I'm not because
Reading the Google Docs API I find this: Downloading Files cannot be downloaded in
I'm working on application that read mail box (pop3 and imap) to prevent email
I am working on a IMAP, so just reading the body (body[header.fields (DATE FROM
I am writing a simple php script for reading emails. When I extract mail
I have some huge binary files which I'm currently reading using memory mapping on
I'm using javamail to check an IMAP inbox, and at the moment I'm simply
Reading a raw 3d (256x256x256 cells) texture (8bit) using the following: f = fopen(file,

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.