Open Closed

Can not self register new user based on app-pro template in a new solution #39


User avatar
0
trendline created

Repro steps:

  1. New a solution based on app-pro template.

  2. Initial the database migration with default seed data.

  3. Run project.IdentityServer

  4. Self Register a new user from page will get a 500 error with below info in logs: An unhandled exception was thrown by the application. System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10061): No connection could be made because the target machine actively refused it. [::ffff:127.0.0.1]:25 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.TcpClient.EndConnect(IAsyncResult asyncResult) at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.InitializeConnectionCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result) at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result) --- End of inner exception stack trace --- 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 Volo.Abp.Account.Emailing.AccountEmailer.SendEmailConfirmationLinkAsync(IdentityUser user, String confirmationToken, String appName) at Volo.Abp.Account.AccountAppService.RegisterAsync(RegisterDto input)

    Is there a place to configure a setting enable the email sending configuration? This should be implemented within account module.


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please see the settings documentation.

    https://docs.abp.io/en/abp/latest/Settings https://docs.abp.io/en/abp/latest/Settings#setting-values-in-the-application-configuration

  • User Avatar
    0
    trendline created

    I followed up your suggestion configured the mail settings in the appsettings.json, but the same configurations works fine under my AspNet Zero application, but failed in abp application, get below logs: System.Net.Mail.SmtpException: Mailbox name not allowed. The server response was: authentication is required at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.EndSend(IAsyncResult result) at System.Net.Mail.SendMailAsyncResult.SendMailFromCompleted(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source) at System.Net.Mail.SendMailAsyncResult.End(IAsyncResult result) at System.Net.Mail.SmtpClient.SendMailCallback(IAsyncResult result) --- End of stack trace from previous location where exception was thrown --- 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 Volo.Abp.Account.Emailing.AccountEmailer.SendEmailConfirmationLinkAsync(IdentityUser user, String confirmationToken, String appName) at Volo.Abp.Account.AccountAppService.RegisterAsync(RegisterDto input)

    I searched this exception on the web, still not get an avaialbe solution.

  • User Avatar
    0
    trendline created

    One more question, is there a place to configure disable the email sending ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please share your email configuration.

    One more question, is there a place to configure disable the email sending ?

    It is not yet configurable, we can consider adding a setting to configure it.

  • User Avatar
    0
    trendline created
    "Settings": {
        "Abp.Mailing.DefaultFromAddress": "email-sender@mydomain.com",
        "Abp.Mailing.DefaultFromDisplayName": "email-sender",
        "Abp.Mailing.Smtp.Host": "smtp.mydomain.com",
        "Abp.Mailing.Smtp.Port": "25",
        "Abp.Mailing.Smtp.Domain": "mail.mydomain.com",
        "Abp.Mailing.Smtp.UseDefaultCredentials": "False",
        "Abp.Mailing.Smtp.UserName": "email-sender@mydomain.com",
        "Abp.Mailing.Smtp.Password": "not encrypted password",
        "Abp.Mailing.Smtp.EnableSsl": "False"
      }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Have you used MailKit in zero?

    If yes, please use Volo.Abp.MailKit in abp vnext

  • User Avatar
    0
    trendline created

    yes, zero using MailKit. How to replace Volo.Abp.Mailing instead of Volo.Abp.MailKit in abp vNext?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Just reference the package.

    https://www.nuget.org/packages/Volo.Abp.MailKit/

    [DependsOn(typeof(AbpMailKitModule)]
    
  • User Avatar
    0
    trendline created

    Using Volo.Abp.MailKit resolved this issue.

    Thanks for your help, Maliming.

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