linotp.lib.emailprovider module

Interface to an EMail provider and implementation of the SMPT email provider

class linotp.provider.emailprovider.IEmailProvider[source]

Bases: object

An abstract class that has to be implemented by ever e-mail provider class

static getConfigMapping()[source]

for dynamic, adaptive config entries we provide the abilty to have dedicated config entries

entries should look like: {

key: (ConfigName, ConfigType)

}

loadConfig(configDict)[source]

If you implement an e-mail provider that does not require configuration entries, then you may leave this method unimplemented.

Parameters:configDict (dict) – A dictionary that contains all configuration entries you defined (e.g. in the linotp.ini file)
provider_type = 'email'
submitMessage(email_to, message, subject=None)[source]

This method has to be implemented by every subclass of IEmailProvider. It will be called to send out the e-mail.

Parameters:
  • email_to (string) – The e-mail address of the recipient
  • message (string) – The message sent to the recipient
Returns:

A tuple of success and a message

Return type:

bool, string

class linotp.provider.emailprovider.SMTPEmailProvider[source]

Bases: linotp.provider.emailprovider.IEmailProvider

Sends e-mail over a SMTP server.

DEFAULT_EMAIL_FROM = 'linotp@example.com'
DEFAULT_EMAIL_SUBJECT = 'Your OTP'
loadConfig(configDict)[source]

Loads the configuration for this e-mail e-mail provider

Parameters:configDict (dict) – A dictionary that contains all configuration entries you defined (e.g. in the linotp.ini file)
submitMessage(email_to, message, subject=None)[source]

Sends out the e-mail.

Parameters:
  • email_to (string) – The e-mail address of the recipient
  • message (string) – The message sent to the recipient
  • subject (string) – otional the subject sent to the recipient
Returns:

A tuple of success and a message

Return type:

bool, string