Ends in:
7 DAYS
11 HRS
17 MIN
14 SEC
Ends in:
7 D
11 H
17 M
14 S
Open Closed

IEmailSender not working #5772


User avatar
0
Shanzhi_Chen created

I followed the official document https://docs.abp.io/zh-Hans/abp/latest/Emailing, I tried to send an email, but I never got any email successfully.

I tried both ways to configure Email settings,

1, Add from Angular UI -> Settings 2, Add 'Settings' json node to appsettings.json with encrypted password .

None of them could send an Email successfully, it was so frustrating.

By the way, there was a very bad experience in which I could not get any exception or log print when I called IEmailSender.SendAsync, just like a black box, nobody knows if the result is failed or successful.

My appsettings.json is below

 "Settings": {
        "Abp.Mailing.Smtp.Host": "smtp.office365.com",
        "Abp.Mailing.Smtp.Port": "587",
        "Abp.Mailing.Smtp.UserName": "no_reply@***.com",
        "Abp.Mailing.Smtp.Password": "***", // encrypted password
        "Abp.Mailing.Smtp.Domain": "smtp.office365.com",
        "Abp.Mailing.Smtp.EnableSsl": "false",
        "Abp.Mailing.Smtp.UseDefaultCredentials": "false",
        "Abp.Mailing.DefaultFromAddress": "no_reply@***.com",
        "Abp.Mailing.DefaultFromDisplayName": "no-reply"
    },

3 Answer(s)
  • User Avatar
    0
    Shanzhi_Chen created

    I saw the log printed,

    USING NullEmailSender

    What's the meaning of that? How to figure out?

  • User Avatar
    0
    Shanzhi_Chen created

    I read the document again, at the bottom of the doc, I found

    #if DEBUG
            context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
    #endif
    

    Now, I removed it. But got the server error response.

    The server response was: 5.7.3 STARTTLS is required to send mail [MW4PR04CA0068.namprd04.prod.outlook.com 2023-09-13T19:26:35.653Z 08DBB3F5C6583CE3]

  • User Avatar
    0
    Shanzhi_Chen created

    It works, after set enable ssl to true.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06