Emails within both InstantForum & InstantKB are sent using the classes and methods available within the standard System.Net.Mail namespace provided by the .NET framework.
By default whenever an email is generated within either InstantForum or InstantKB we add this email to the InstantASP_Emails database table provided within each product.
We then use a HTTP Module (InstantASP.Common.HttpModule.EmailModule) to initialize a timer and background thread to periodically query the InstantASP_Emails table and send emails every X number of minutes in a specific quantity.
Both the polling interval and the number of emails sent per poll can be configured. To configure how often the HTTP module will query the InstantASP_Emails table you would need to adjust the “InstantASP_EmailInterval” application setting within our web.config file.
To change how many emails are sent on each poll you can adjust the “Emails Per Cycle” setting within both the InstantForum & InstantKB admin control panels.
We would suggest you keep the emails sent per cycle per default and the pool internal per default. These are already well configured and typically only need tweaking in very specific scenarios. By default the poll interval is every 60 seconds and emails will be sent in batches of 50.
Why do we store email in the database?
The primary reason is for performance. Storing the emails in the database and sending these on a background thread ensure the UI thread is not interrupted and the user receives a responsive experience even if they performance an action that generated 10,000 emails.
Supported SMTP Delivery Methods
We support all the standard ASP.NET mail delivery methods. These include “PickupDirectoryFromIis”, “SpecifiedPickupDirectory” & “Network”.
The default is “Network”. This means our software will attempt to communicate with the SMTP server you have specified within either the InstantForum or InstantKB Admin Control Panel whenever an email is sent. If you specify an SMTP username and password these will also be used when communicating with your SMTP server. We support the most common methods of communicated with SMTP servers. These include…
- Anonymous SMTP
- SMTP Authentication
- SMTP over SSL
Send Emails Right Away
If the “InstantASP_AutoFlushMailQueue" application setting within our web.config file is set to “true” emails will be sent right away. This will attempt to send every email within the InstantASP_Emails table whenever a new email is triggered.
This means our software will attempt to communicate with your SMTP server and send all emails within the InstantASP_Emails table as soon as the user performs an action that triggers an email.
If an exception occurs whilst sending these emails they won't be deleted from the queue table and so if the user click the back buttons and attempts to post the message again some users may receive duplicate emails depending on where the exception occurs within the queue. To avoid this we would always suggest you leave “InstantASP_ AutoFlushMailQueue” set to false.
Where do emails appear to come from?
Whenever an application generated email is created within either InstantForum or InstantKB the sender email address will be obtained from the “Application Email” you've specified within either the InstantForum or InstantKB Admin Control Panels.
What Happens If An Email Fails?
An email can fail for many reasons. For example may be the recipients mail box is full or maybe the sender address is not valid.We handle email slightly different depending on how you have the InstantASP_AutoFlushMailQueue application setting configured within our web.config file. These are described below...
AutoFlushMailQueue Set to False
If you have “InstantASP_ AutoFlushMailQueue” set to the default value of “false” within the web.config we will track the fact the email failed and will increment the “EmailAttempts” column within the InstantASP_Emails table each time the email fails.
By default we will attempt to send the email 3 times. If the email fails 3 times in a row when the InstantASP_Emails table is polled for a fourth time the failed emails will be deleted.
You can configure how many times either InstantForum or InstantKB will attempt to send an email before it’s automatically deleting this from the InstantASP_Emails table within both the InstantForum & InstantKB Admin Control Panel settings pages.
AutoFlushMailQueue Set to True
If you have “InstantASP_ AutoFlushMailQueue” set to “true” within the web.config file emails will be sent on the UI thread. This means if any exception occur whilst sending an email your users may receive a run-time exception. This is obviously not the preferred behaviour however this can be helpful to troubleshoot and diagnose email issues.
How do I troubleshoot email issues?
For further information on troubleshooting email issues please see the "Debugging Email Problems with InstantForum & InstantKB" article linked below.
Optionally provide private feedback to help us improve this article...
Thank you for your feedback!