Does anyone know how can i queue azure emails and send them in a queue?
Like for example I wanna to create a job to send emails at 10:00 at noon, so it should send that time, not instantly like Azure provides in their documentation. in python.
def _send(self, data: Dict[str, Any], recipients: List[CustomUser]) -> None:
self._email_template.validate_data(data)
self._initialize_message()
relative_link = self._email_template.get_relative_link(data)
context = self._email_template.get_template_context(data)
context.update({"relative_link": relative_link})
self._message.update({"recipients": {"to": self._get_recipients(recipients)}})
self._message["content"].update({"html": self._render_template(context)})
try:
client = self._initialize_connection()
response = client.begin_send(self._message)
except Exception as ex:
logger.error(f"Error occurred during email sending: {ex}")
raise ex
i just use being_send, there is also async being_send, but its not solving my problem. Should i use kafka and rabbirmq for triggering messages from my app? I would prefer use something which offers Azure tbh. Sorry, i mean its my 1st time on stackoverflow, so I'm kinda shy lol
The sample below is an Azure Functions Python script that uses the Azure Communication Services Email SDK to send an email using a timer trigger.
The function sets a timer trigger to run at the desired time for sending emails, and the timer interval is appropriately set for your use case.
Output: