#3366 closed (fixed)
Replace datatuple with object in send_mass_mail parameters
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Mail) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
With the features wanting to be added for sending mail (attachements #1541, bcc's #3307, etc.), the datatuple is starting to get out of hand. I propose some sort of EmailMessage
class for storing all these different data pieces as attributes. This way, the attachment, bcc, etc. parameters can be optional keyword arguments for the EmailMessage
constructor.
Attachments (3)
Change History (11)
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 18 years ago
by , 18 years ago
comment:3 by , 18 years ago
Has patch: | set |
---|---|
Needs documentation: | set |
Patch added EmailConnection and EmailMessage classes. The mail_admins
and mail_managers
functions are backwards compatible, but I removed send_mail
and send_mass_mail
since it seemed that implementing them would be sort of redundant.
What used to be send_mail(...)
can now be accomplished with EmailMessage(...).send()
.
What used to be send_mass_mail(...)
can now be accomplished with EmailConnection().send_messages(...)
.
The implementation in the patch should make it pretty easy to add Cc's and Bcc's (#3307) and attachments (#1541) with cc
, bcc
, and attachments
parameters to EmailMessage's constructor. An add_attachment
method might be nice too.
comment:4 by , 18 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Design decision needed → Accepted |
Jacob would like to see the send_mail()
and send_mass_mail()
functions stay for backwards compatibility, but could be deprecated for 1.0.
comment:5 by , 18 years ago
by , 18 years ago
Attachment: | 3366.3.diff added |
---|
Fixed EmailMessage class from_email bug in init method.
comment:7 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [5141]) Fixed #3366 -- Part 1 of the email code refactoring and feature extension. This
part refactors email sending into a more object-oriented interface in order to
make adding new features possible without making the API unusable. Thanks to
Gary Wilson for doing the design thinking and initial coding on this.
Includes documentation addition, but it probably needs a rewrite/edit, since
I'm not very happy with it at the moment.
Please see discussion at #1541.