Copied to clipboard

Flag this post as spam?

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


  • Simeon Ostberg 123 posts 389 karma points
    Mar 05, 2021 @ 10:30
    Simeon Ostberg
    0

    Forms Razor email template - test somehow?

    Hi everyone,

    I'm working on an razor email template at the moment. Is there a way to test the code without having to send an email all the time?

    I only know: If the email comes, the code worked. If not, it didn't work. But I don't know, what didn't work.

    All the best, Simeon

  • Simon Justesen 74 posts 193 karma points
    Mar 05, 2021 @ 11:10
    Simon Justesen
    0

    Hi Simeon,

    If you're working locally on your dev machine, you can use a tool like Papercut SMTP to test outgoing mail
    https://github.com/ChangemakerStudios/Papercut-SMTP

    If you need to test on a remote machine, you can configure .NET to output mail to a directory on the server:
    https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/specifiedpickupdirectory-element-network-settings

  • Simeon Ostberg 123 posts 389 karma points
    Mar 05, 2021 @ 11:38
    Simeon Ostberg
    0

    Hi Simon,

    So, there is no way to get a YSOD page like when testing partials or other stuff?

    Best, Simeon

  • Simon Justesen 74 posts 193 karma points
    Mar 05, 2021 @ 14:35
    Simon Justesen
    100

    Yes, there is a config setting in UmbracoSettings.xml where you can get macros to throw a regular YSOD, the default is just to display an inline text error.

      <!-- How Umbraco should handle errors during macro execution. Can be one of the following values:
         - inline - show an inline error within the macro but allow the page to continue rendering. Historial Umbraco behaviour.
         - silent - Silently suppress the error and do not render the offending macro.
         - throw  - Throw an exception which can be caught by the global error handler defined in Application_OnError. If no such
                    error handler is defined then you'll see the Yellow Screen Of Death (YSOD) error page.
         Note the error can also be handled by the umbraco.macro.Error event, where you can log/alarm with your own code and change the behaviour per event. -->
    <MacroErrors>throw</MacroErrors>
    
  • Simeon Ostberg 123 posts 389 karma points
    Mar 05, 2021 @ 16:33
    Simeon Ostberg
    0

    Thank you!

    I will try that!

  • Simon Justesen 74 posts 193 karma points
    Mar 05, 2021 @ 17:28
    Simon Justesen
    0

    Cool, have a nice weekend! :)

Please Sign in or register to post replies

Write your reply to:

Draft