- Developer Resources
- Using Eleflex.Email Module as an Example
Using Eleflex.Email Module as an Example
For the next sections, we are going to examine the Eleflex.Email Module. The source code for the Eleflex.Email module is included in the same release as the ELEFLEX complete source code. Download the complete source code online. The Eleflex.Email module project files are located in the solution folder under Release/NuGet.
The Email Module provides distributed storage and sending of emails. By default in the ELELFEX platform, emails are sent directly to an SMTP server. If the SMTP server is offline, the email trying to be sent could be lost, or an application workflow could not proceed unless the email is sent. To alleviate this, the Email module provides the following functionality:
It creates a database tables used to store email messages temporarily.
It creates an object location configuration that maps the existing ASP.NET Identity email store to use its service, which stores the email in the database table instead of trying to send it immediately.
It creates a web process that runs every minute to see if any email messages need to be sent. It will then pull messages out in a queue fashion and attempts to send the email. If it succeeds, it marks the email as being sent. If a send error happens, the email stays in the queue and will be attempted later.
It creates a web process that runs once every 8 hours to purge emails from the system that are older than a configured number of days. By default, emails are deleted after being 30 days old.