我正在尝试在 ASP.NET Boilerplate 中设置 MailKit 以发送电子邮件,但尽管我在app.config文件中添加了设置,但我仍然收到此异常。
发送电子邮件的代码:
_emailSender.Send(
to: "*****@gmail.com",
subject: "You have a new task!",
body: $"A new task is assigned for you: <b>Create doFramework</b>",
isBodyHtml: true
);
收到异常:
{Abp.AbpException: 'Abp.Net.Mail.DefaultFromAddress' 的设置值为 null 或为空!在 Abp.Net.Mail.EmailSenderConfiguration.GetNotEmptySettingValue(String name) in D:\Github\aspnetboilerplate\src\Abp\Net\Mail\EmailSenderConfiguration.cs:line 44 at Abp.Net.Mail.EmailSenderBase.NormalizeMail(MailMessage mail)在 D:\Github\aspnetboilerplate\src\Abp\Net\Mail\EmailSenderBase.cs:line 96 at Abp.Net.Mail.EmailSenderBase.Send(MailMessage mail, Boolean normalize) in D:\Github\aspnetboilerplate\src\Abp \Net\Mail\EmailSenderBase.cs:line 73 at TaskManagmentApp.Tasks.TaskAppService.GetAll(GetAllTasksInput input) in C:\Users\Dopravo\source\repos\doFramework\SampleProjects\TaskManagmentApp\src\TaskManagmentApp.Application\Services\TaskAppService .cs:第 36 行,位于 Castle.Proxies.Invocations。
app.config文件:
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
<appSettings>
<add key="Abp.Net.Mail.DefaultFromAddress" value="lkaddoura@dopravo.com"/>
<add key="Abp.Net.Mail.DefaultFromDisplayName" value="Lutfi Kaddoura"/>
</appSettings>
</configuration>
相关分类