Opened 18 years ago

Closed 18 years ago

Last modified 18 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: 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)

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

Download all attachments as: .zip

Change History (11)

comment:1 by Gary Wilson <gary.wilson@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by bruce@…, 18 years ago

Please see discussion at #1541.

by Gary Wilson <gary.wilson@…>, 18 years ago

Attachment: 3366.diff added

comment:3 by Gary Wilson <gary.wilson@…>, 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 Gary Wilson <gary.wilson@…>, 18 years ago

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.

by Gary Wilson <gary.wilson@…>, 18 years ago

Attachment: 3366.2.diff added

updated patch

comment:5 by Gary Wilson <gary.wilson@…>, 18 years ago

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

comment:6 by Gary Wilson <gary.wilson@…>, 18 years ago

Patch needs improvement: unset

The patch still needs some testing.

by karsu, 18 years ago

Attachment: 3366.3.diff added

Fixed EmailMessage class from_email bug in init method.

comment:7 by Malcolm Tredinnick, 18 years ago

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 by sime <simon@…>, 18 years ago

See #1541 for unified patch

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