I am setting up a membership section on our website, and I need it to send an account confirmation email. Rather than hard-coding the format of the email, I'd like to use a CSHTML template, like the ones Umbraco Forms uses. I see packages that enable this, but for our project we're trying to avoid 3rd-party packages.
Is there any way to do one of the following?
From a Surface Controller, programmatically post data (email address and email confirmation link) to an Umbraco Forms form, and trigger a template-based Workflow email to be sent to the email that was passed programmatically.
From a Surface Controller, trigger the code that Umbraco Forms uses to send out template-based emails, pass data into that email template, and send out an email (not necessarily sending data into Umbraco Forms).
Any other thoughts on how I could send out a template-based email without a 3rd-party package would be greatly appreciated.
The following is all theory but might get you started...
In the controller you would need to "scrape" the rendered html from the page to form the email content.
So with this in mind:
Setup the template you want
Test is renders OK in the browser.
In order to personalise you would obviously need to use the member ID, so could code the page so that it can read a query string parameter via a controller, and render the page based on the resulting model.
Then in your email controller code up the URL and read the resulting HTML from it.
Sending out template emails programmatically?
I am setting up a membership section on our website, and I need it to send an account confirmation email. Rather than hard-coding the format of the email, I'd like to use a CSHTML template, like the ones Umbraco Forms uses. I see packages that enable this, but for our project we're trying to avoid 3rd-party packages.
Is there any way to do one of the following?
From a Surface Controller, programmatically post data (email address and email confirmation link) to an Umbraco Forms form, and trigger a template-based Workflow email to be sent to the email that was passed programmatically.
From a Surface Controller, trigger the code that Umbraco Forms uses to send out template-based emails, pass data into that email template, and send out an email (not necessarily sending data into Umbraco Forms).
Any other thoughts on how I could send out a template-based email without a 3rd-party package would be greatly appreciated.
Thanks,
David
Hi David
The following is all theory but might get you started...
In the controller you would need to "scrape" the rendered html from the page to form the email content.
So with this in mind:
Hope this helps
Nigel
Nigel,
Great idea, I'm going to use this approach.
Thanks,
David
is working on a reply...