Code

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3366 closed (fixed)

Replace datatuple with object in send_mass_mail parameters

Reported by: Gary Wilson <gary.wilson@…> Owned by: adrian
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@…> 7 years ago.
3366.2.diff (8.2 KB) - added by Gary Wilson <gary.wilson@…> 7 years ago.
updated patch
3366.3.diff (8.2 KB) - added by karsu 7 years ago.
Fixed EmailMessage class from_email bug in init method.

Download all attachments as: .zip

Change History (11)

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by bruce@…

Please see discussion at #1541.

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

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

  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Design decision needed to 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.

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

updated patch

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

  • Patch needs improvement unset

The patch still needs some testing.

Changed 7 years ago by karsu

Fixed EmailMessage class from_email bug in init method.

comment:7 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to 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.

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

See #1541 for unified patch

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.