Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#3366 closed (fixed)

Replace datatuple with object in send_mass_mail parameters

Reported by: Gary Wilson <gary.wilson@…> Owned by: Adrian Holovaty
Component: Core (Mail) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

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)

3366.diff (6.9 KB) - added by Gary Wilson <gary.wilson@…> 10 years ago.
3366.2.diff (8.2 KB) - added by Gary Wilson <gary.wilson@…> 10 years ago.
updated patch
3366.3.diff (8.2 KB) - added by karsu 9 years ago.
Fixed EmailMessage class from_email bug in init method.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 10 years ago by bruce@…

Please see discussion at #1541.

Changed 10 years ago by Gary Wilson <gary.wilson@…>

Attachment: 3366.diff added

comment:3 Changed 10 years ago by Gary Wilson <gary.wilson@…>

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 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Needs tests: set
Patch needs improvement: set
Triage Stage: Design decision neededAccepted

Jacob would like to see the send_mail() and send_mass_mail() functions stay for backwards compatibility, but could be deprecated for 1.0.

Changed 10 years ago by Gary Wilson <gary.wilson@…>

Attachment: 3366.2.diff added

updated patch

comment:5 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Patch updated to reflect changes in [4536], [4570] and [4574]. Also re-implemented send_mail and send_mass_mail for backward compatibility.

comment:6 Changed 10 years ago by Gary Wilson <gary.wilson@…>

Patch needs improvement: unset

The patch still needs some testing.

Changed 9 years ago by karsu

Attachment: 3366.3.diff added

Fixed EmailMessage class from_email bug in init method.

comment:7 Changed 9 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(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.

comment:8 Changed 9 years ago by sime <simon@…>

See #1541 for unified patch

Note: See TracTickets for help on using tickets.
Back to Top