-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Emails): pouvoir envoyer les e-mails transactionnels depuis TemplateTransactional #1034
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG!
lemarche/conversations/models.py
Outdated
@@ -233,3 +234,26 @@ def get_template_id(self): | |||
elif self.source == conversation_constants.SOURCE_BREVO: | |||
return self.brevo_id | |||
return None | |||
|
|||
def send_transactional_email(self, recipient_email, recipient_name, variables): | |||
print("send_transactional_email", self.source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Un petit print
qui est resté.
lemarche/conversations/models.py
Outdated
recipient_email=recipient_email, | ||
recipient_name=recipient_name, | ||
variables=variables, | ||
# from_email=self.email_from_email, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tu ne le fais pas là, mais dans l'idée on pourrait surcharger l'expéditeur ? Brevo et Mailjet le permettent ?
846d7c4
to
80a4509
Compare
3b00bba
to
75ac069
Compare
75ac069
to
867e0b0
Compare
21c4a83
to
172a2c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Quoi ?
Suite à #1018 on a maintenant un modèle
TemplateTransactional
dans lequel on configure nos envois d'e-mails.En fonction de la config choisie, je rajoute une méthode
send_transactional_email()
qui permet d'envoyer directement un e-mail, via Mailjet ou Brevo.subject
est vide par défaut, il utilisera la config en ligne (gros changement ! d'habitude on gérait les subject dans le code)from_email
&from_name
sont overridablesJ'ai testé avec le template "NEW_USER_PASSWORD_RESET" et ca marche bien 👍
Suite
Dans la prochaine PR - #1019 - on commencera à utiliser ce nouveau mécanisme pour les envois d'e-mails existants. En s'assurant que le subject est bien configuré à la fois dans Mailjet et Brevo.