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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:27:01+00:00 2026-05-10T21:27:01+00:00

I am having difficulty determining if the body of a text email message is

  • 0

I am having difficulty determining if the body of a text email message is base64 encoded. if it is then use this line of code; making use of jython 2.2.1

dirty=base64.decodebytes(dirty) 

else continue as normal.

This is the code I have atm. What line of code will allow me to extract this from the email:

‘Content-Transfer-Encoding: base64’

import email, email.Message import base64  def _get_email_body(self):     try:         parts=self._email.get_payload()         check=parts[0].get_content_type()         if check=='text/plain':             part=parts[0].get_payload()             enc = part[0]['Content-Transfer-Encoding']             if enc == 'base64':                 dirty=base64.decodebytes(dirty)         elif check=='multipart/alternative':             part=parts[0].get_payload()             enc = part[0]['Content-Transfer-Encoding']             if part[0].get_content_type()=='text/plain':                 dirty=part[0].get_payload()                 if enc == 'base64':                     dirty=base64.decodebytes(dirty)             else:                 return 'cannot obtain the body of the email'         else:             return 'cannot obtain the body of the email'         return dirty     except:         raise 

OKAY this code works now! thanks all

  • 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. 2026-05-10T21:27:02+00:00Added an answer on May 10, 2026 at 9:27 pm

    Try:

    enc = msg['Content-Transfer-Encoding'] 

    It’s a header so you won’t be able to get it looking at the body. You should be able to get at the same place you find out the Subject.

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

Sidebar

Related Questions

I currently use iText for PDF generation and I am having difficulty determining if
I'm having some difficulty determining what search solution to use in my new iPhone
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
I'm having difficulty searching for this. How would I define an element in an
I am having difficulty connecting my java code to sql server database. I can
I'm having difficulty referencing this from within a javascript inline function, within an object
I'm having difficulty trying to figure this out. I'm not even sure if it's
Having difficulty making my javascript act the way I want. I have a button,
I'm having difficulty extracting a single node value from a nodelist. My code takes
I am having difficulty geting a very simple view to display. This view has

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.