I am trying to send email using following script but it's not working and throwing error:
<cfmail to="[email protected]"
from="[email protected]"
<!--- subject="#sub#" --->
type="html"
server="smtp.sendgrid.net"
timeout="360"
username="un"
password="psw" >
<cfmailparam name="X-SMTPAPI" value="{\"category\":\"Cool Emails\"}">
<cfoutput>
Hello
</cfoutput>
</cfmail>
Error is :Invalid token \ found on the <cfmailparam tag line
I have tried removing tags as well still it didn't work.
That is not how you escape quotes in CFML. You should be able to just double them up. Like so:
Or you could use single-quotes to surround your values instead of double quotes. This will allow you to use double-quotes within your values. Like so:
Also, in your example you do not need to use
<cfoutput>
tags within the<cfmail>
tags.