StackExchange.Exceptional icon indicating copy to clipboard operation
StackExchange.Exceptional copied to clipboard

Exception Emails are not sent in asp.net core 3.1 razor pages

Open fingers10 opened this issue 4 years ago • 1 comments

I'm configuring exceptional email options in my asp.net core 3.1 app. But doesn't seem to work.

here is my start up,

services.AddExceptional(settings =>
{
    settings.Store.ApplicationName = "Exceptional.Web";
    settings.Store.Type = "SQL";
    settings.Store.ConnectionString = "Server=(localdb)\\mssqllocaldb;Database=ExceptionalDemos;Trusted_Connection=True;MultipleActiveResultSets=true";
    settings.UseExceptionalPageOnThrow = false;
    settings.Email.ToAddress = "[email protected]";
    settings.Email.FromAddress = "[email protected]";
    settings.Email.FromDisplayName = "[email protected]";
    settings.Email.SMTPHost = "xxxx.xxxx.net";
    settings.Email.SMTPPort = 0000;
    settings.Email.SMTPUserName = "[email protected]";
    settings.Email.SMTPPassword = "xxxx";
    settings.Email.SMTPEnableSSL = true;
});

I'm using the same to send email in my app and it works,

using (var smtp = new SmtpClient("xxxx.xxxx.net", 0000))
{
    smtp.UseDefaultCredentials = false;
    smtp.EnableSsl = true;
    NetworkCredential credentials = new NetworkCredential("[email protected]", "xxxx");
    smtp.Credentials = credentials;
    var msg = new MailMessage
    {
        Body = "Error From App",
        Subject = "Error Test",
        From = new MailAddress("[email protected]")
    };
    msg.To.Add("[email protected]");
    await smtp.SendMailAsync(msg);
}

I not able to find out any error messages logged in console. Any ideas on why the exception emails are not getting sent?

fingers10 avatar Mar 19 '20 11:03 fingers10