#27465: Allow EmailMessage to load attachments from the Storage API
-------------------------------------+-------------------------------------
Reporter: Thomas Güttler | Owner: nobody
Type: New feature | Status: closed
Component: Core (Mail) | Version: 1.10
Severity: Normal | Resolution:
| needsnewfeatureprocess
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mike Edmunds):
* resolution: => needsnewfeatureprocess
* status: new => closed
Comment:
I think there's probably an opportunity to leverage the `EmailAttachment`
class (introduced in Django 5.2) to simplify creating attachments from
file paths, Django `File` objects, and/or Django storages…
{{{#!python
from django.core.mail import EmailMessage, EmailAttachment
EmailMessage(
...,
attachments=[
EmailAttachment.read(path_or_filename), # equivalent to
msg.attach_file()
EmailAttachment.from_file(django_file_object),
EmailAttachment.from_storage(...), # ???
],
).send()
}}}
Either class methods as shown here, or maybe a constructor override?
The "new feature process" is the current approach for iterating this sort
of design. I'm closing this ticket with that in mind, and would encourage
anyone interested to open a [https://github.com/django/new-features new-
features] proposal.
--
Ticket URL: <https://code.djangoproject.com/ticket/27465#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019ec221c7ab-18b538ba-a160-426f-a30c-3862947664c3-000000%40eu-central-1.amazonses.com.