Class EmailReceiver

Inheritance Relationships

Derived Types

Class Documentation

class EmailReceiver

Abstract email receiver.

Receives, or fetches, emails.

Subclassed by email::CurlEmailReceiver, email::IntraEmailReceiver

Public Functions

EmailReceiver()

Constructor.

virtual ~EmailReceiver()
void shutdown()

Shut down.

Stops any currently-running internal polling loop.

virtual std::optional<struct EmailData> get_email(std::optional<std::chrono::nanoseconds> polling_period = std::nullopt) = 0

Get a new email.

This function fetches a new email through polling.

The caller can specify a polling period, which will be used as a target polling rate. This means that, if the internal polling call takes more time than the polling period, the next call will be executed right away.

If the polling period value is equal to 0, the sleep call will be skipped, and polling will be done as fast as possible. This is the default value.

Parameters:

polling_period – the polling period

Returns:

the new email, or std::nullopt if it failed

Protected Attributes

std::shared_ptr<Logger> logger_
std::atomic_bool do_shutdown_