Copied to clipboard

Flag this post as spam?

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


  • Hannes 28 posts 189 karma points
    Mar 09, 2023 @ 18:38
    Hannes
    0

    Custom workflow using Email Template - Umbraco Forms 10

    Hi,

    How can I use the EmailTemplatePicker in a custom workflow for Umbraco Forms v10? I have the workflow and everything setup but I'm not sure how to use the selected Razor template as email content. I used to be able to do this:

    record.ParseWithRazorView(filePath);
    

    but it looks like that method is not available anymore. I couldn't find anything in the documentation on that specific matter.

    Anybody that could provide any assistance with that is be much appreciated.

    Thanks, Hannes

  • Hannes 28 posts 189 karma points
    Jul 06, 2023 @ 15:44
    Hannes
    100

    I figured this out. The solution was to have you class inherit from : SendRazorEmail. Then inside your method create a new workflow and execute that workflow to send the custom razor email:

    var workflow = new SendRazorEmail(
                    _hostingEnvironment,
                    _options,
                    _httpContextAccessor,
                    _fieldTypeStorage,
                    _formService,
                    _umbracoContextAccessor,
                    _pageService,
                    _workflowEmailService,
                    _mediaFileManager,
                    _fileSystems,
                    _publishedUrlProvider,
                    _logger,
                    _placeholderParsingService,
                    _prevalueSourceService,
                    _fieldPreValueSourceTypeService)
                    {
                        SenderEmail = fromEmail,
                        Email = toEmail,
                        Subject = "Your subject line goes here",
                        RazorViewFilePath = RazorViewFilePath,
                    };
    
                    workflow.Execute(context);
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies