Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure SendEmail Submit Action parameters are generated as valid JSON. #26

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

medkg15
Copy link
Contributor

@medkg15 medkg15 commented Feb 8, 2021

WFFM email save actions whose email body contains double quotes would result in an invalid parameters JSON value, causing the Sitecore Forms editor to display blank email values. Using a JSON serializer will ensure valid JSON is generated.

Example input causing failure:

<host>192.168.1.1</host>
<from>noreply@example.com</from>
<isbodyhtml>true</isbodyhtml>
<to>test@example.com</to>
<cc/>
<bcc>test2@example.com</bcc>
<localfrom>noreply@example.com</localfrom>
<subject>Example</subject>
<mail>
	<strong>
		<span style=\"color: #c00000;\">Details</span>
	</strong>
	<div>
		<strong>Name</strong>:&#160;[<label id=\"{EF3C323A-EA48-4C1C-9CDC-FB7E89F82956}\">Name</label>]
	</div>
</mail>

Previous output:

{
	"from": "noreply@example.com",
	"to": "test@example.com",
	"cc": "",
	"bcc": "test2@example.com",
	"subject": "Example",
	"message": "<strong><span style="color: #c00000;">Details</span></strong><div><strong>Name</strong>: [Name]</div>",
	"isHtml": true,
	"customSmtpConfig": "<Host>192.168.1.1</Host>"
}

New output:

(Double quotes are escaped in message field)

{
	"from": "noreply@example.com",
	"to": "test@example.com",
	"cc": "",
	"bcc": "test2@example.com",
	"subject": "Example",
	"message": "<strong><span style=\"color: #c00000;\">Details</span></strong><div><strong>Name</strong>: [Name]</div>",
	"isHtml": "true",
	"customSmtpConfig": "<Host>192.168.1.1</Host>"
}

@afaniuolo
Copy link
Owner

@medkg15 Thank you for this pull request. I will review it next week.

@afaniuolo afaniuolo changed the base branch from main to v1.3.3 April 9, 2021 02:18
@afaniuolo afaniuolo merged commit d6a0ba8 into afaniuolo:v1.3.3 Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants