Open Closed

Email Sender not working #4095


0
mikeolofernes created

HI,

I tried the Email Sending function you have and it is not working. The details I saved on the Settings/Emailing is not loading. I also tried the Send test email and its also not working.

Thanks, Mike If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v6.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes /
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

18 Answer(s)
  • 0
    maliming created
    Support Team

    hi

    What's the value of your Host setting?

  • 0
    mikeolofernes created

    hi

    What's the value of your Host setting?

    I used 104.21.13.176 for testing, but the first issue is that the values I saved is not loading.

    Thanks, Mike

  • 0
    maliming created
    Support Team

    but the first issue is that the values I saved is not loading.

    I don't get it. Can you explain more?

    I also tried the Send test email and its also not working.

    Please remove the NullEmailSender.

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

    but the first issue is that the values I saved is not loading.

    I don't get it. Can you explain more?

    I also tried the Send test email and its also not working.

    Please remove the NullEmailSender.

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

    As you can see in this screenshot, SMTP Host is still null. Already removed the NullEmailSender. The test send email works now but if i use this code, the SMTP Host and other values are still null. Thanks, Mike

  • 0
    maliming created
    Support Team

    hi

    Can you reproduce it in a new template project? [email protected]

  • 0
    mikeolofernes created

    hi

    Can you reproduce it in a new template project? [email protected]

    Create a new project from scratch? I havent tried that but this project of ours is still new, no development made on the backend, only on the frontend side.

    I am thinking, the values are not initiating properly? Do I need to load/initiate it manually? Do note that send test email is working, I just created a test function to send an email but the values like SMTP host is not loading.

    Thanks, Mike

  • 0
    maliming created
    Support Team

    What are full steps to reproduce in a new template?

  • 0
    mikeolofernes created

    What are full steps to reproduce in a new template?

    Are you talking about the email template?

  • 0
    mikeolofernes created

    I am confused. Why are you asking me to create a new template? We used command lines to create the solution. something like abp new Acme.IssueManagement -t module-pro

  • 0
    liangshiwei created
    Support Team

    Hi,

    Could you share the full steps to reproduce it? as you know, we need to reproduce it first and then find a solution

  • 0
    mikeolofernes created

    I put the code in the backend of Blazor razor page then just created a button on the frontend to trigger the code.

    using System; using System.Threading.Tasks; using Volo.Abp.Emailing; using Volo.Abp.Emailing.Templates; using Volo.Abp.TextTemplating;

    namespace FireBird.Blazor.Pages;

    public partial class Index { private readonly IEmailSender _emailSender; private readonly ITemplateRenderer _templateRenderer;

    public Index(
    IEmailSender emailSender,
    ITemplateRenderer templateRenderer)
    {
        _emailSender = emailSender;
        _templateRenderer = templateRenderer;
    }
    
    public async Task email()
    {
        try
        {
            var body = await _templateRenderer.RenderAsync(
            StandardEmailTemplates.Message,
            new
            {
                message = "This is email body ABP test..."
            }
        );
    
            await _emailSender.SendAsync("[email protected]",
                "[email protected]",
                "ABP Email subject test",
                "This is email body ABP test..."
            );
        }
        catch (Exception ex)
        {
            var x = ex.Message;
        }
        
    }
    

    }

  • 0
    maliming created
    Support Team

    hi

    What are the values of the SMTP settings?

  • 0
    mikeolofernes created

  • 0
    mikeolofernes created

    Do I need to share also the password?

  • 0
    maliming created
    Support Team

    Yes please send it to [email protected] I will test it.

  • 0
    mikeolofernes created

    Password sent. You did not respond.

  • 0
    maliming created
    Support Team

    Can I check your app by zoom remotely?

    https://us05web.zoom.us/j/89210760707?pwd=NW1wVWovMlR0ZE1pVzR3dUZhMm52QT09

  • 0
    maliming created
    Support Team

    hi mikeolofernes

    I have confirmed.

    You can get email settings from blazor app, because the email settings are not visible to client.

    You can only call an API from blazor, and the backend to send to email.