Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason D 75 posts 247 karma points
    Mar 05, 2023 @ 01:57
    Jason D
    0

    Trigger an email notification via code

    I have custom errors logging successfully, but there is an example of a failure error that I'd like to be notified by email, and can add this email trigger in my custom method.

    Is there a way to trigger an email, either via the Log function, or as a custom method? I'm on 8.18.5 at this moment.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 07, 2023 @ 07:39
    Dave Woestenborghs
    100

    Hi Jason,

    You could install the serilog e-mail sink : https://github.com/serilog/serilog-sinks-email

    And configure that with log level Error. That way all the errors will be e-mailed.

    See the docs for configuration : https://our.umbraco.com/documentation/Reference/Configuration-for-Umbraco-7-and-8/Serilog/

    Dave

  • Jason D 75 posts 247 karma points
    Mar 07, 2023 @ 17:40
    Jason D
    0

    Perfect. Thanks!

  • Mikael Axel Kleinwort 154 posts 499 karma points c-trib
    1 week ago
    Mikael Axel Kleinwort
    0

    Hi Dave,

    I am trying to use the Serilog email sink, however, I am unsure where to add the logger in Startup.cs. I am on Umbraco V13. Do you have a hint?

    I know how to create the new LoggerConfiguration, but what I don't knwo is what to do with it then :-)

    I try to do it in code, rather than in appsettings.json, since this way, it is easier to pull in secret credential information from other places.

    Kind regards, Mikael

Please Sign in or register to post replies

Write your reply to:

Draft