from typing import Optional from .ses_send_email import send_email def send_alliance_email( template_type, inviter_email, recipient, alliance_name, message=None, temp_passwd=None, ): """Send invite to Data Alliance. Depending on whether invitee exists or not, uses different template""" # default template params template_params = {"inviter_email": inviter_email, "alliance_name": alliance_name} email_params = { "sender": '"FanSifter" ', "recipients": recipient, "subject": "FanSifter Data Alliance Invitation!", } template_file: Optional[str] = None if template_type == "invite_existing_user": template_file = "html/alliance_invite_existing.html" template_params["message"] = message elif template_type == "invite_new_user": template_file = "html/alliance_invite_new.html" template_params["message"] = message template_params["temp_passwd"] = temp_passwd elif template_type == "remove_member": template_file = "html/alliance_remove_member.html" email_params["subject"] = "FanSifter Data Alliance Notice" if template_file: send_email(template_file, template_params, email_params)