为了账号安全,请及时绑定邮箱和手机立即绑定

从配置文件中获取设置

从配置文件中获取设置

C#
慕森卡 2021-06-04 10:09:09
我正在尝试在 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>
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 188 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信