5. Email/GMail

This module contains constants function for the email module.

This module is responsible for sending the account activation email.

ptmd.lib.email.core.build_email_core(title: str, email: str) MIMEMultipart

Build the core of the email and return a MIMEMultipart object.

Parameters
  • title – the title of the email

  • email – the email of the user

Returns

the core of the email

ptmd.lib.email.core.send_confirmation_mail(username: str, email: str, token: str) str

Send the account activation email to the user.

Parameters
  • username – the name of the user

  • email – the email of the user

  • token – the token to be used to activate the account

Returns

the message sent to the user

ptmd.lib.email.core.send_email(message: MIMEMultipart, service: Any, body: str) str

Send the email to the user.

Parameters
  • message – the MIMEMultipart object to be used to send the email

  • service – the service to be used to send the email

  • body – the body of the email

ptmd.lib.email.core.send_reset_pwd_email(username: str, email: str, token: str) str

Send the reset password token to the user.

Parameters
  • username – the name of the user

  • email – the email of the user

  • token – the token to be used to reset the account password

Returns

the message sent to the user

ptmd.lib.email.core.send_validated_account_mail(username: str, email: str) str

Send the notification to the user that the account is now active.

Parameters
  • username – the name of the user

  • email – the email of the user

Returns

the message sent to the user

ptmd.lib.email.core.send_validation_mail(user: object) str

Send the notification to the admin that a user account needs activation.

Parameters

user – the User class to be used to get the user information

Returns

the message sent to the user

Module to load the email templates

ptmd.lib.email.load_templates.create_confirmation_email_content(username: str, token: str) str

Create the content of the confirmation email to be sent to the user.

Parameters
  • username – the name of the user

  • token – the token to be used to activate the account

Returns

the content of the email

ptmd.lib.email.load_templates.create_reset_pwd_mail_content(username: str, token: str) str

Create the content of the email to be sent to the user.

Parameters
  • username – the name of the user

  • token – the token to be used to activate the account

Returns

the content of the email

ptmd.lib.email.load_templates.create_validated_email_content(username: str) str

Create the content of the email to be sent to the user when his account has been validated by an admin.

Parameters

username – the name of the user

Returns

the content of the email

ptmd.lib.email.load_templates.create_validation_mail_content(user: Any) str

Create the content of the email to be sent to the user.

Parameters

user – the user account to activate

Returns

the content of the email

This module contains utility function for the email module.

ptmd.lib.email.utils.get_config() str

Get the configuration file for the Google Drive API.

Returns

the path to the credentials file