Skip Navigation

[Resolved] tags added to notification email

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by dougW-4 6 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1137049

I am trying to: Send an XML ADF formatted email as the notification from a CRED submission (hidden link). Essentially I just want the email notification to send exactly what I have in the editor. When it actually sends it includes <p> tags, that I can't identify any reason. I've tried minifying the code so it's all on one line and still get them. Is there any way to stop all formatting of the email body before sending it?

Thank you for your help,

Link to a page where the issue can be seen: hidden link

I expected to see:


<?xml version="1.0" encoding="UTF-8"?>
<?adf version="1.0"?>
<adf>
	<prospect status="used">
		<id sequence="1" source="Website">%%POST_ID%%</id>
		<requestdate>%%DATE_TIME%%</requestdate>
		<vehicle interest="buy" status="used">
			<id sequence="1" source="">%%POST_ID%%</id>
			<model>[types field='car-you-re-interested-in' output="raw"][/types]</model>
		</vehicle>
		<customer>
			<contact primarycontact="1">
				<name part="full">%%POST_TITLE%%</name>
				<email>[types field='email' output="raw"][/types]</email>
				<phone>[types field='phone'][/types]</phone>
			</contact>
			<comment>[types field='question' output="raw"][/types] - [types field='car-url' output="raw"][/types]</comment>
		</customer>
		<vendor>
			<contact>
				<name>Taylor's United Auto Sales</name>
				<address>
					<street line="1">1755 N Holmes Ave</street>
					<city>Idaho Falls</city>
					<regioncode>ID</regioncode>
					<postalcode>83401</postalcode>
					<country>US</country>
				</address>
			</contact>
		</vendor>
		<provider>
			<name part="full" type="business">TheDealio</name>
			<service>Website Car Inquiry</service>
			<url><em><u>hidden link</u></em>;
			<email preferredcontact="1">hello@thedealio.org</email>
			<phone>2084732015</phone>
			<source>Website</source>
		</provider>
	</prospect>
</adf>

Instead, I got:

<p>
	<?xml version="1.0" encoding="UTF-8"?>
	<?adf version="1.0"?>
	<adf>
		<prospect status="used">
			<id sequence="1" source="Website">4286196</id>
			<requestdate>2018-10-30 18:17:07</requestdate>
			<vehicle interest="buy" status="used">
				<id sequence="1" source="">4286196</id>
				<model></model>
				<url>
					<a href="<em><u>hidden link</u></em>" title="<em><u>hidden link</u></em>"><em><u>hidden link</u></em>;
				</url>
			</vehicle>
			<customer>
				<contact primarycontact="1">
					<name part="full">Private: test</name>
					<email>asdf</email>
					<phone>asdf</phone>
				</contact>
				<comment>
					<p>adf</p>
				</comment>
			</customer>
			<vendor>
				<contact>
					<name>Taylor&#8217;s United Auto Sales</name>
				</p>
				<address>
					<street line="1">1755 N Holmes Ave</street>
					<city>Idaho Falls</city>
					<regioncode>ID</regioncode>
					<postalcode>83401</postalcode>
					<country>US</country>
				</address>
				<p>
				</contact>
			</vendor>
			<provider>
				<name part="full" type="business">TheDealio</name>
				<service>Website Car Inquiry</service>
				<url><em><u>hidden link</u></em>;
				<email preferredcontact="1">hello@thedealio.org</email>
				<phone>2084732015</phone>
				<source>Website</source>
			</provider>
		</prospect>
	</adf>
</p>
#1137502

Hi Doug,

Thank you for contacting us and I'll be happy to assist.

I'm afraid, there is no filter available to turn off automatic formatting of form's email notification.

But to have absolute control over the output of your email in XML ADF format, you can create a custom function that sends this email directly, connected to "cred_submit_complete" hook.
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete )

For example:


add_action('cred_submit_complete', 'my_custom_action',10,2);
function my_custom_action($post_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==123)
    {
        // code to send the email directly
    }
}

Note: Please replace 123, with the ID of your actual form.

Following article has useful information around creating a custom PHP function to send email in XML ADF format:
hidden link

I hope this helps.

regards,
Waqar

#1137653

Thank you for such a thorough and helpful response. Although a little disappointing that WP insists on inserting those <p> tags wherever it can, your suggestions seem like a workable solution.