Hi Muskan. 

Thanks for picking this up. 

The discussion on the ticket seems reasonable to me: it's probably, on the 
margin, a common enough case to justify a TemplatedMessage subclass that 
wraps up the render_to_string() dance there. That seems small enough and 
addressable. 

As 
per 
https://docs.djangoproject.com/en/3.1/topics/email#s-topics-sending-multiple-emails
 
the backend send_messages() already takes a list of EmailMessage objects, 
so you'd call that to send multiple templated messages. 

(It's an open question as whether the send_mass_mail() helper should take a 
list of message objects, as well as the current tuple... — I'm not sure the 
addition fits the pattern for a single message: If you have an EmailMessage 
you just call message.send(), rather than passing it back to the helper 
function... — I'd defer thinking about that.)

I  hope that helps. 

Kind Regards,

Carlton



On Sunday, 21 March 2021 at 16:17:45 UTC+1 muskan...@gmail.com wrote:

> I came across this issue #17193 which is quite old, that I'd like 
> clarification/discussion on. 
> To summarize the discussion that took place there 
> <https://code.djangoproject.com/ticket/17193> as well as from an older 
> discussion 
> <https://groups.google.com/g/django-developers/c/RyjyDdgCPdk/m/zrBWquobWOUJ>
> :
>  The ticket was raised in hopes of allowing the sending of mail from a 
> template without having to use the roundabout of the 'render_to_string' 
> method before the "html_message" attribute was added to send_mail and 
> EmailMessage. After this attribute was added, the discussion was that the 
> use cases for this template format were even more reduced and that 
> implementing it through a third-party package would perhaps be more elegant.
>
> Consider the following use case: You have a student lifecycle management 
> system in which you need to send the same circular to all students and 
> parents fitting certain criteria, with only a few changes such as name, 
> class, etc. 
> In this particular scenario, you would send a  templated email to a lot of 
> people, or, in other words, a mass templated email with only the context 
> and recipient changing. While third party packages could accomplish this 
> one way or another, it is my opinion that a more elegant solution could be 
> provided by Django. 
> Considering, that this sort of situation seems quite likely to arise, and 
> the age of this ticket, I wonder if there has been any development in this 
> area since, which I could not find in my own research on this issue. If so 
> I would appreciate it if you could point me in the correct direction. 
> If not, I would like to open discussion for potential solutions to this.
> If this is finally deemed unnecessary, it becomes a simple matter of 
> closing the ticket.
>
>
> In relevance to this, even in the absence of support for TemplatedMails, 
> it perhaps would be useful to allow sending mass emails while also allowing 
> the usage of the EmailMessage format of more descriptive emails. This might 
> be accomplished by allowing a list of EmailMessage objects in the helper 
> function "send_mass_mail" or maybe by creating a new EmailMessages object 
> to do this. 
>
> Would appreciate your input on this.
> ----
> Regards
> Muskan Vaswan
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ff1a8690-5df4-45b0-b2ea-69dcd978d76fn%40googlegroups.com.

Reply via email to