Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
maxking opened this issue Mar 1, 2018 · 4 comments
Labels
3.8 only security fixes stdlib Python modules in the Lib dir topic-email type-feature A feature request or enhancement

Comments

@maxking
Copy link
Contributor

maxking commented Mar 1, 2018

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']

@maxking
Copy link
Contributor Author

maxking commented Mar 1, 2018

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.

@maxking maxking added topic-email type-feature A feature request or enhancement labels Mar 1, 2018
@maxking
Copy link
Contributor Author

maxking commented Mar 1, 2018

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.

@bitdancer
Copy link
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.

@bitdancer bitdancer added the 3.8 only security fixes label Mar 2, 2018
@maxking
Copy link
Contributor Author

maxking commented Mar 2, 2018

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 only security fixes stdlib Python modules in the Lib dir topic-email type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants