6.1.1.3.2.9. linotp.lib.emailprovider module

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

class linotp.lib.emailprovider.IEmailProvider[source]

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

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)
submitMessage(email_to, message)[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.lib.emailprovider.SMTPEmailProvider[source]

Bases: linotp.lib.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)[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
Returns:

A tuple of success and a message

Return type:

bool, string