Umbraco Forms - how to dynamically send to selected email address?
Hi,
I am building some Umbraco Forms. Instead of having the form send to email addresses added in the back office, we want to send the forms information to an address that is selected by the user from a drop down menu containing multiple email addresses.
You should be able to use the bracket syntax to access the form values from the email workflow settings.
So for your example you might have a drop down field called Address to Send To which contains all the valid email address's. To access the value that has been selected by the user you would use {addresstosendto} in the email receiver field found in the work flow settings.
thanks that is good. One other thing though. I want to be able to list names in the dropdown menu and then associate those names with actual email addresses. Do you know how this can be achieved?
I ended up using jQuery to solve this because I can't find any other decent way. All the tutorials out there are for a very old version of Contour and the new Umbraco Forms does not have the same options. Here was my solution:
you can create a custom dropdown like below. Add this to your form and set the comma separated values . enter each email, text pair in new line.
Then you can capture the selected value (email address) in your custom workflow and send email accordingly.
public sealed class EnhancedDropDownList : FieldType
{
[global::Umbraco.Forms.Core.Attributes.Setting("Comma-separated values. The first value is the value that will be submitted. The second value is the display name.", view = "textarea", description = "The first value is the value that will be submitted. The second value is the display name.")]
public string PreValues { get; set; }
[global::Umbraco.Forms.Core.Attributes.Setting("Default Value", view = "textfield", description = "Default value of the dropdownlist")]
public string DefaultValue { get; set; }
public EnhancedDropDownList()
{
Name = "Enhanced Drop Down List";
Id = new Guid("10942e58-4e0f-4e5c-8371-14e32ca2c571");
Description = "DropDownList with extra features";
Icon = "dropdownlist.png";
DataType = FieldDataType.String;
}
public string RenderPreview()
{
return "<select><option value=\"\"></option></select>";
}
public string RenderPreviewWithPrevalues(List<object> prevalues)
{
return RenderPreview();
}
}
Umbraco Forms - how to dynamically send to selected email address?
Hi,
I am building some Umbraco Forms. Instead of having the form send to email addresses added in the back office, we want to send the forms information to an address that is selected by the user from a drop down menu containing multiple email addresses.
How can this be achieved?
Thanks a lot for any info!
Hi Damon,
You should be able to use the bracket syntax to access the form values from the email workflow settings.
So for your example you might have a drop down field called Address to Send To which contains all the valid email address's. To access the value that has been selected by the user you would use {addresstosendto} in the email receiver field found in the work flow settings.
Hopefully this is what you are looking for.
Paul
Hi Paul,
thanks that is good. One other thing though. I want to be able to list names in the dropdown menu and then associate those names with actual email addresses. Do you know how this can be achieved?
Thanks a lot!
I ended up using jQuery to solve this because I can't find any other decent way. All the tutorials out there are for a very old version of Contour and the new Umbraco Forms does not have the same options. Here was my solution:
I placed this code block on the page with the embedded form and it renders the way I want.
It would be more idea if Umbraco Forms select boxes supported both field values as well as a way to edit/move the values after they have been created.
you can create a custom dropdown like below. Add this to your form and set the comma separated values . enter each email, text pair in new line. Then you can capture the selected value (email address) in your custom workflow and send email accordingly.
is working on a reply...