iiuni / projektzapisy

System Zapisów na zajęcia w Instytucie Informatyki Uniwersytetu Wrocławskiego
https://zapisy.ii.uni.wroc.pl
31 stars 10 forks source link

[mailer] masowa wysyłka maili - ograniczenie liczby logowań #118

Closed lewymati closed 7 years ago

lewymati commented 7 years ago

Wygląda na to że podczas wysyłania każdego maila otwierane jest osobne połączenie SMTP. https://github.com/lewymati/projektzapisy/blob/master/zapisy/mailer/engine.py#L78

Trzeba zmodyfikować kod, by otwierał O(1) połączeń ;) można użyć np: https://django.readthedocs.io/en/1.4/topics/email.html#send-mass-mail albo zrobić to bardziej niskopoziomowo: https://django.readthedocs.io/en/1.4/topics/email.html#sending-multiple-emails

bpodrygajlo commented 7 years ago

Uzyc send_mass_email Z dokumentacji: send_mass_mail() vs. send_mail()

The main difference between send_mass_mail() and send_mail() is that send_mail() opens a connection to the mail server each time it’s executed, while send_mass_mail() uses a single connection for all of its messages. This makes send_mass_mail() slightly more efficient.

Link https://docs.djangoproject.com/en/1.10/topics/email/