Skip to content

mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API #77156

Open

Description

@maxking
BPO 32975
Nosy @warsaw, @bitdancer, @maxking

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2018-03-01.05:44:18.590>
labels = ['type-feature', '3.8', 'expert-email']
title = 'mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API'
updated_at = <Date 2018-03-02.02:29:36.775>
user = 'https://github.com/maxking'

bugs.python.org fields:

activity = <Date 2018-03-02.02:29:36.775>
actor = 'maxking'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['email']
creation = <Date 2018-03-01.05:44:18.590>
creator = 'maxking'
dependencies = []
files = []
hgrepos = []
issue_num = 32975
keywords = []
message_count = 4.0
messages = ['313082', '313083', '313120', '313122']
nosy_count = 3.0
nosy_names = ['barry', 'r.david.murray', 'maxking']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue32975'
versions = ['Python 3.8']

Activity

  1. maxking commented on Mar 1, 2018

    @maxking
    ContributorAuthor

    Since Python 3.6 the new EmailMessage API seems to be the default but mailbox.Message still subclasses from the old email.message.Message API.

    It would be nice to get EmailMessage from mailbox so that one can rely on the new methods and content managers. Also, while it is possible to pass a constructor to mailbox.mbox to get the new EmailMessage style message, it is different from mailbox.Message which has some extra methods.

  2. maxking commented on Mar 1, 2018

    @maxking
    ContributorAuthor

    I should also mention probably that I went ahead and made changes to make this work and I can pass most of the tests, one is failing due to missing \n character in the header's value obtained from msg.get_all('Received').

    I can make a pull request on Github if that would be a good place to start the discussion instead.

  3. bitdancer commented on Mar 2, 2018

    @bitdancer
    Member

    This is a reasonable request (a good way to use EmailMessage), but EmailMessage is not yet the default even for the email package. You have to specify policy=default to get it (or use it to construct a message).

    Mailbox probably needs some backward compatible way for the user to specify the policy.

  4. maxking commented on Mar 2, 2018

    @maxking
    ContributorAuthor

    Can you suggest what would be the best way go about doing that?

    Given that mailbox.Message subclasses from Message, I am not sure how to proceed about this to make this configurable with a flag.

    I haven't yet made a PR, but this1 is the URL to the change I made.

  5. transferred this issue fromon Apr 10, 2022
  6. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 23, 2023
  7. takeda commented on Jun 30, 2024

    @takeda

    Are there any plans to fix that? It feels like this was overlooked by whomever was working on the improved message.

    I'm wondering if there's any workaround to use the new EmailMessage? for example is it acceptable to pass it as a factory or is there a better way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions