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

  • Home
  • SEARCH
  • 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 6934979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:02:16+00:00 2026-05-27T12:02:16+00:00

I am trying to use python’s imaplib and email.feedparser to grab an attachment out

  • 0

I am trying to use python’s imaplib and email.feedparser to grab an attachment out of a gmail inbox. The email is generated by an external party and sent to us, so I have no control over it.

The trouble is that the message I am trying to parse has msg.get_content_maintype() return 'text' instead of 'multitype'. As a result the uuencoded attachment gets concatenated with the rest of the message and I don’t see an ease way to pull it out of email.message.Message.

Any ideas how I can extract the attachment out of such an email?

If it is any help, the email has ‘Produced By Microsoft MimeOLE V6.00.3790.4862’ in it. Thunderbird also had trouble rendering this email and wasn’t able to figure out that it had an attachment. Otherwise, the message looks ok in Outlook and Gmail web client.

  • 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-27T12:02:16+00:00Added an answer on May 27, 2026 at 12:02 pm

    As email.parser.FeedParser documentation says you can use _factory parameter to provide your own Message class. You could put your own class derived from email.message.Message that will replace message contenttype with the correct one if this message was composed in “Produced By Microsoft MimeOLE …blablabla”.

    I think it is safe to expect that the messagesin this particular case will always be multipart.

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

Sidebar

Related Questions

I am trying to use python's imaplib to create an email and send it
I am trying to use a python script to call an external command a
I'm trying to use python to parse a log file and match 4 pieces
I am trying to use Python's ElementTree to generate an XHTML file. However, the
I am trying to use Python to resize picture. With my camera, files are
I'm trying to use Python to run pdftotext, but for some reason, my code
I'm trying to use Python 2.7 regex's to retrieve data from sample web pages
I am trying to use python socket instead of netcat to send metric data
I am trying to use python's telnetlib module to get information from a remote
I am getting some unexpected results when trying to use Python Omni Completion on

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.