You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.5 KiB
2.5 KiB
LINGYUN.Abp.ExceptionHandling.Emailing
An email notification type based on the ABP framework's IExceptionSubscriber interface.
Features
- Supports exception email notifications
- Supports custom email templates
- Supports multilingual email content
- Supports stack trace sending
- Supports mapping between exception types and recipient mailboxes
Configuration and Usage
Before use, you need to configure AbpExceptionHandlingOptions to define which exceptions need notifications, then configure AbpEmailExceptionHandlingOptions to define specific exception type notification methods.
[DependsOn(
typeof(AbpEmailingExceptionHandlingModule)
)]
public class YouProjectModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
// Customize exceptions to handle
Configure<AbpExceptionHandlingOptions>(options =>
{
// Add exception types that need to be handled
options.Handlers.Add<AbpException>();
});
// Customize exception types that need email notifications
Configure<AbpEmailExceptionHandlingOptions>(options =>
{
// Whether to send stack trace information
options.SendStackTrace = true;
// Default receiving email for unspecified exception receivers
options.DefaultReceiveEmail = "colin.in@foxmail.com";
// Specify which email to send for a certain exception type
options.HandReceivedException<AbpException>("colin.in@foxmail.com");
});
}
}
Configuration Options
SendStackTrace: Whether to include exception stack trace in the emailDefaultTitle: Default email titleDefaultContentHeader: Default email content headerDefaultContentFooter: Default email content footerDefaultReceiveEmail: Default exception receiving emailHandlers: Dictionary mapping exception types to receiving emails
Localization Resources
The module includes localization resources in the following languages:
- en
- zh-Hans
Related Links
More
For more information and configuration examples, please refer to the documentation.