Skip to content
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

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

raphodn
Copy link
Contributor

@raphodn raphodn commented Jan 9, 2024

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.

  • le subject est vide par défaut, il utilisera la config en ligne (gros changement ! d'habitude on gérait les subject dans le code)
  • les champs from_email & from_name sont overridables
  • on arrête de vouloir stocker ces infos dans le modèle, c'est trop variable, on verra plus tard si ca peut être intégré

J'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.

@raphodn raphodn self-assigned this Jan 9, 2024
Copy link
Contributor

@SebastienReuiller SebastienReuiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG!

@@ -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)
Copy link
Contributor

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

recipient_email=recipient_email,
recipient_name=recipient_name,
variables=variables,
# from_email=self.email_from_email,
Copy link
Contributor

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 ?

@raphodn raphodn force-pushed the raphodn/emails-brevo-configuration branch from 846d7c4 to 80a4509 Compare January 16, 2024 12:24
Base automatically changed from raphodn/emails-brevo-configuration to master January 16, 2024 15:05
@raphodn raphodn force-pushed the raphodn/conversation-template-refactor-brevo branch from 3b00bba to 75ac069 Compare January 16, 2024 15:07
@raphodn raphodn added the Emails label Feb 9, 2024
@raphodn raphodn force-pushed the raphodn/conversation-template-refactor-brevo branch from 75ac069 to 867e0b0 Compare April 29, 2024 15:42
@raphodn raphodn changed the title Emails : envoyer les e-mails transactionnels depuis TemplateTransactional feat(emails) : pouvoir envoyer les e-mails transactionnels depuis TemplateTransactional Apr 29, 2024
@raphodn raphodn changed the title feat(emails) : pouvoir envoyer les e-mails transactionnels depuis TemplateTransactional feat(Emails): pouvoir envoyer les e-mails transactionnels depuis TemplateTransactional Apr 30, 2024
@raphodn raphodn force-pushed the raphodn/conversation-template-refactor-brevo branch from 21c4a83 to 172a2c6 Compare April 30, 2024 10:12
@raphodn raphodn requested a review from madjid-asa April 30, 2024 10:14
Copy link
Contributor

@madjid-asa madjid-asa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@raphodn raphodn merged commit 6836178 into master Apr 30, 2024
8 checks passed
@raphodn raphodn deleted the raphodn/conversation-template-refactor-brevo branch April 30, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants