Django

Code

Ticket #3366 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

Replace datatuple with object in send_mass_mail parameters

Reported by: Gary Wilson <gary.wilson@gmail.com> Assigned to: adrian
Milestone: Component: django.core.mail
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 1
Needs tests: 1 Patch needs improvement: 0

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

3366.diff (6.9 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 02/11/07 23:04:15.
3366.2.diff (8.2 kB) - added by Gary Wilson <gary.wilson@gmail.com> on 03/17/07 23:41:20.
updated patch
3366.3.diff (8.2 kB) - added by karsu on 04/01/07 06:25:57.
Fixed EmailMessage? class from_email bug in init method.

Change History

01/24/07 23:20:34 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

02/03/07 19:49:35 changed by bruce@coderseye.com

Please see discussion at #1541.

02/11/07 23:04:15 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3366.diff added.

02/11/07 23:17:19 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_docs set to 1.
  • has_patch set to 1.

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.

02/27/07 14:59:04 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch set to 1.
  • needs_tests set to 1.
  • 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.

03/17/07 23:41:20 changed by Gary Wilson <gary.wilson@gmail.com>

  • attachment 3366.2.diff added.

updated patch

03/17/07 23:44:29 changed by Gary Wilson <gary.wilson@gmail.com>

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

03/17/07 23:48:43 changed by Gary Wilson <gary.wilson@gmail.com>

  • needs_better_patch deleted.

The patch still needs some testing.

04/01/07 06:25:57 changed by karsu

  • attachment 3366.3.diff added.

Fixed EmailMessage? class from_email bug in init method.

05/03/07 06:35:12 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

06/13/07 20:15:16 changed by sime <simon@quo.com.au>

See #1541 for unified patch


Add/Change #3366 (Replace datatuple with object in send_mass_mail parameters)




Change Properties
Action