Open Closed

EmailSend get exception #2249


User avatar
0
zhongfang created
  • ABP Framework version: v4.3.3

  • UI type: Blazor (Server Side)

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes

  • Exception message and stack trace: [2021-12-07T03:00:03.979Z] Error: Volo.Abp.AbpException: Setting value for 'Abp.Mailing.DefaultFromAddress' is null or empty! at Volo.Abp.Emailing.EmailSenderConfiguration.GetNotEmptySettingValueAsync(String name) at Volo.Abp.Emailing.EmailSenderBase.NormalizeMailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml)

  • Steps to reproduce the issue:" 1)get encypted password in debug mode. 2)store setting values in appsettings.json as follow "Settings": { "Abp.Localization.DefaultLanguage": "zh-Hans", "Volo.Abp.LeptonTheme.Style": "Style6", "Volo.Abp.LeptonTheme.Layout.MenuPlacement": "Top", "Volo.Abp.LeptonTheme.Layout.MenuStatus": "AlwaysOpened", "Volo.Abp.LeptonTheme.Layout.Boxed": "False", "Abp.Mailing.Smtp.Host": "smtp.exmail.qq.com", "Abp.Mailing.Smtp.Port": "465", "Abp.Mailing.Smtp.UserName": "no-reply@.com", "Abp.Mailing.Smtp.Password": "w8rSB5k/dFA==", "Abp.Mailing.Smtp.Domain": "", "Abp.Mailing.Smtp.EnableSsl": "true", "Abp.Mailing.Smtp.UseDefaultCredentials": "false", "Abp.Mailing.DefaultFromAddress": "no-reply@.com", "Abp.Mailing.DefaultFromDisplayName": "" } 3)prepare an empty Blazor razor page as below public partial class SendEmail { private readonly IEmailSender _emailSender; public SendEmail( IEmailSender emailSender) { _emailSender = emailSender; } protected override async Task OnInitializedAsync() { await this.SendTest(); }

      public async Task SendTest()
      {
          await _emailSender.SendAsync("****@qq.com",
              "测试",
              "正文内容.....");
      }
    

    } 4) in olde project ,got an exception as step 2. 5) I create a new solution via ABP suite 4.3.3, Blazor Server Side Application. with no error. but I can not receive the mail.


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer
    1. in olde project ,got an exception as step 2.

    What's the abp version?

    . with no error. but I can not receive the mail.

    What are the relevant logs?

  • User Avatar
    0
    zhongfang created
    1. the ABP version is 4.3.3, too.
    2. the new project is 4.3.3, too.
    3. the logs of the new project (no error, no mail) is: 2021-12-07 14:39:21.176 +08:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: SettingManagement.Emailing 2021-12-07 14:39:21.177 +08:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpAccount.SettingManagement 2021-12-07 14:39:21.177 +08:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: AbpIdentity.SettingManagement 2021-12-07 14:39:21.178 +08:00 [INF] Authorization failed. These requirements were not met: PermissionRequirement: LeptonThemeManagement.Settings 2021-12-07 14:39:21.246 +08:00 [INF] Authorization failed. These requirements were not met: DenyAnonymousAuthorizationRequirement: Requires an authenticated user. 2021-12-07 14:39:21.261 +08:00 [INF] Request starting HTTP/2 GET https://localhost:44313/images/logo/logo-light.png - - 2021-12-07 14:39:21.261 +08:00 [INF] Request starting HTTP/2 GET https://localhost:44313/libs/flag-icon-css/flags/1x1/gb.svg - - 2021-12-07 14:39:21.261 +08:00 [INF] The file /images/logo/logo-light.png was not modified 2021-12-07 14:39:21.262 +08:00 [INF] The file /libs/flag-icon-css/flags/1x1/gb.svg was not modified 2021-12-07 14:39:21.262 +08:00 [INF] Request finished HTTP/2 GET https://localhost:44313/images/logo/logo-light.png - - - 304 - image/png 0.5777ms 2021-12-07 14:39:21.262 +08:00 [INF] Request finished HTTP/2 GET https://localhost:44313/libs/flag-icon-css/flags/1x1/gb.svg - - - 304 - image/svg+xml 0.3216ms 2021-12-07 14:40:21.339 +08:00 [WRN] Unhandled exception rendering component: Syntax error, command unrecognized. The server response was: System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of stack trace from previous location --- at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml) at Demo433.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 24 at Demo433.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 19 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2021-12-07 14:40:21.348 +08:00 [ERR] Unhandled exception in circuit 'kwUp1jmtH_Rc6-MDm2vn3Xykyz2QDXAFIZQT4z2Fwfw'. System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of stack trace from previous location --- at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize) at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml) at Demo433.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 24 at Demo433.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 19 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) 2021-12-07 14:40:21.368 +08:00 [INF] Executed endpoint '/_blazor' 2021-12-07 14:40:21.368 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:44313/_blazor?id=ehsPS3cBwAdsduTL_unX1w - - - 101 - - 60206.4197ms 2021-12-07 14:40:43.449 +08:00 [INF] Request starting HTTP/2 POST https://localhost:44313/_blazor/disconnect multipart/form-data;+boundary=---------------------------4834409823873905815870511039 393 2021-12-07 14:40:43.452 +08:00 [INF] No CORS policy found for the specified request. 2021-12-07 14:40:43.452 +08:00 [INF] Executing endpoint 'Blazor disconnect' 2021-12-07 14:40:43.453 +08:00 [INF] Executed endpoint 'Blazor disconnect' 2021-12-07 14:40:43.453 +08:00 [INF] Request finished HTTP/2 POST https://localhost:44313/_blazor/disconnect multipart/form-data;+boundary=---------------------------4834409823873905815870511039 393 - 200 0 - 3.4877ms
  • User Avatar
    0
    zhongfang created

    In new project (4.3.3), I changed the setting value of "UseDefaultCredentials" from "true" to "yes". I got new exception as below

    2021-12-07 14:42:55.020 +08:00 [INF] Request starting HTTP/2 GET https://localhost:44313/images/logo/logo-light.png - -
    2021-12-07 14:42:55.020 +08:00 [INF] The file /images/logo/logo-light.png was not modified
    2021-12-07 14:42:55.021 +08:00 [INF] Request starting HTTP/2 GET https://localhost:44313/libs/flag-icon-css/flags/1x1/gb.svg - -
    2021-12-07 14:42:55.021 +08:00 [INF] Request finished HTTP/2 GET https://localhost:44313/images/logo/logo-light.png - - - 304 - image/png 1.8345ms
    2021-12-07 14:42:55.022 +08:00 [INF] The file /libs/flag-icon-css/flags/1x1/gb.svg was not modified
    2021-12-07 14:42:55.022 +08:00 [INF] Request finished HTTP/2 GET https://localhost:44313/libs/flag-icon-css/flags/1x1/gb.svg - - - 304 - image/svg+xml 0.9580ms
    2021-12-07 14:43:55.081 +08:00 [WRN] Unhandled exception rendering component: Syntax error, command unrecognized. The server response was: 
    System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: 
       at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
       at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
    --- End of stack trace from previous location ---
       at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml)
       at Demo433.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 24
       at Demo433.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 19
       at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
       at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
    2021-12-07 14:43:55.086 +08:00 [ERR] Unhandled exception in circuit 'Z-ckYB7CxK-4rit3lI4lU8efC-nRB7_EBhVTR5INWf8'.
    System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: 
       at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
       at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
    --- End of stack trace from previous location ---
       at Volo.Abp.Emailing.Smtp.SmtpEmailSender.SendEmailAsync(MailMessage mail)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml)
       at Demo433.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 24
       at Demo433.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\Demo433\aspnet-core\src\Demo433.Blazor\Pages\Test\SendEmail.razor.cs:line 19
       at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
       at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)
    2021-12-07 14:43:55.242 +08:00 [INF] Executed endpoint '/_blazor'
    2021-12-07 14:43:55.242 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:44313/_blazor?id=Gi7V50X6Age10rvWYS56cA - - - 101 - - 60354.8596ms
    2021-12-07 14:44:48.678 +08:00 [DBG] Stopped background worker: Volo.Abp.BackgroundJobs.BackgroundJobWorker
    2021-12-07 14:44:48.678 +08:00 [DBG] Stopped background worker: Volo.Abp.IdentityServer.Tokens.TokenCleanupBackgroundWorker
    2021-12-07 14:44:48.678 +08:00 [INF] Application is shutting down...
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Test your email configure first.

    https://github.com/abpframework/abp-samples/tree/master/EmailSendDemo

  • User Avatar
    0
    zhongfang created

    Now, I changed a mail provider. Use port 25 with no SSL The I send email successfully in NEW blank Project. If I use port 465 with SSL enabled. It can not send email.

    But still get same error in old project.

    2021-12-07 16:16:27.331 +08:00 [INF] Request finished HTTP/2 POST https://localhost:44314/_blazor/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0 - 200 316 application/json 2.3743ms
    2021-12-07 16:16:27.397 +08:00 [INF] Request starting HTTP/1.1 GET https://localhost:44314/_blazor?id=rkA99C1LoRKNTZGVyxkcbQ - -
    2021-12-07 16:16:27.399 +08:00 [INF] Executing endpoint '/_blazor'
    2021-12-07 16:16:27.435 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: SettingManagement.Emailing
    2021-12-07 16:16:27.436 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: AbpAccount.SettingManagement
    2021-12-07 16:16:27.436 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: AbpIdentity.SettingManagement
    2021-12-07 16:16:27.436 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: LeptonThemeManagement.Settings
    2021-12-07 16:16:27.463 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: SettingManagement.Emailing
    2021-12-07 16:16:27.464 +08:00 [INF] Authorization failed. These requirements were not met:
    PermissionRequirement: CmsKit.SettingManagement
    2021-12-07 16:16:27.534 +08:00 [WRN] Unhandled exception rendering component: Setting value for 'Abp.Mailing.DefaultFromAddress' is null or empty!
    Volo.Abp.AbpException: Setting value for 'Abp.Mailing.DefaultFromAddress' is null or empty!
       at Volo.Abp.Emailing.EmailSenderConfiguration.GetNotEmptySettingValueAsync(String name)
       at Volo.Abp.Emailing.EmailSenderBase.NormalizeMailAsync(MailMessage mail)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml)
       at Yee.Change.Brain.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\brain\src\Yee.Change.Brain.Blazor\Pages\Test\SendEmail.razor.cs:line 24
       at Yee.Change.Brain.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\brain\src\Yee.Change.Brain.Blazor\Pages\Test\SendEmail.razor.cs:line 19
       at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
    2021-12-07 16:16:27.543 +08:00 [ERR] Unhandled exception in circuit 'yITQ9Kj0Ksm4paz4ASdjsAZ-GQLWBaLiV9xulv8L27I'.
    Volo.Abp.AbpException: Setting value for 'Abp.Mailing.DefaultFromAddress' is null or empty!
       at Volo.Abp.Emailing.EmailSenderConfiguration.GetNotEmptySettingValueAsync(String name)
       at Volo.Abp.Emailing.EmailSenderBase.NormalizeMailAsync(MailMessage mail)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(MailMessage mail, Boolean normalize)
       at Volo.Abp.Emailing.EmailSenderBase.SendAsync(String to, String subject, String body, Boolean isBodyHtml)
       at Yee.Change.Brain.Blazor.Pages.Test.SendEmail.SendTest() in C:\dev\gitlab\brain\src\Yee.Change.Brain.Blazor\Pages\Test\SendEmail.razor.cs:line 24
       at Yee.Change.Brain.Blazor.Pages.Test.SendEmail.OnInitializedAsync() in C:\dev\gitlab\brain\src\Yee.Change.Brain.Blazor\Pages\Test\SendEmail.razor.cs:line 19
       at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
    2021-12-07 16:16:27.555 +08:00 [INF] Authorization failed. These requirements were not met:
    DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
    2021-12-07 16:16:27.561 +08:00 [INF] Executed endpoint '/_blazor'
    2021-12-07 16:16:27.562 +08:00 [INF] Request finished HTTP/1.1 GET https://localhost:44314/_blazor?id=rkA99C1LoRKNTZGVyxkcbQ - - - 101 - - 164.3937ms
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    If I use port 465 with SSL enabled. It can not send email.

    It depends on your email service provider.

    But still get same error in old project.

    You can check the setting table. Remove email setting value if you wan to use appsettings.json

  • User Avatar
    0
    zhongfang created

    Now, I removed setting values from appsettings.json in all projects which is Blazor, HttpApi.Host. Only configure the value via Blazor UI. Then I restart the computer. Still got the same Exception.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Have you tried the new database?

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11