fietsboek.email module

Utility functions for email sending.

fietsboek.email.prepare_message(sender, addr_to, subject)

Prepares an email message with the right headers.

The body of the message can be set by using set_content() on the returned message.

Parameters:
  • sender (str) – The email sender.

  • addr_to (str) – Address of the recipient.

  • subject (str) – Subject of the message.

Return type:

EmailMessage

Returns:

A prepared message.

fietsboek.email.send_message(server_url, username, password, message)

Sends an email message using the STMP server configured in the settings.

The recipient is taken from the ‘To’-header of the message.

Parameters:
  • server_url (str) – The URL of the server for mail sending.

  • username (Optional[str]) – The username to authenticate, can be None or empty.

  • password (Optional[str]) – The password to authenticate, can be None or empty.

  • message (EmailMessage) – The message to send.