|
|
@@ -554,23 +554,30 @@ def enviar_correo_inscritos_html(request, evento_id):
|
|
|
|
|
|
from_email = settings.DEFAULT_FROM_EMAIL
|
|
|
|
|
|
+ # Contador para numerar los correos
|
|
|
+ contador = 1
|
|
|
+
|
|
|
for usuario in destinatarios:
|
|
|
+ # Añadir número de correo al asunto
|
|
|
+ asunto_con_numero = f"{asunto} ({contador}/{len(destinatarios)})"
|
|
|
+
|
|
|
html_content = render_to_string(
|
|
|
'emails/correo_a_inscritos.html',
|
|
|
{'evento': evento,
|
|
|
'usuario': usuario,
|
|
|
'mensaje_usuario': mensaje_usuario,
|
|
|
- 'asunto_usuario': asunto_usuario}
|
|
|
+ 'asunto_usuario': asunto_con_numero}
|
|
|
)
|
|
|
|
|
|
msg = EmailMultiAlternatives(
|
|
|
- asunto,
|
|
|
+ asunto_con_numero,
|
|
|
mensaje_usuario,
|
|
|
from_email,
|
|
|
[usuario],
|
|
|
)
|
|
|
msg.attach_alternative(html_content, "text/html")
|
|
|
msg.send()
|
|
|
+ contador += 1
|
|
|
|
|
|
messages.success(request, f"Correo enviado a {len(destinatarios)} inscritos.")
|
|
|
return redirect('eventos:detalle_evento', evento_id=evento.id)
|