Question

I am using SendGrid’s SMTP API (not WEB API) and am considering sending an email using cfmail. If I use cfmail to send the email, and want to use the X-SMTPAPI header somewhere, do you think that cfmail is a place to do that? Please clarify.

Was it helpful?

Solution

You would do this by adding a custom header, using the cfmailparam tag. As such:

<cfmailparam  
    name="X-SMTPAPI" 
    value="{\"category\":\"Cool Emails\"}">

In context of the cfmail tag it would be as follows.

<cfmail 
    from="you@example.com" 
    to="nick@sendgrid.com" 
    subject="I am using CF Mail to do this!"> 
<cfmailparam  
    name="X-SMTPAPI" 
    value="{\"category\":\"Cool Emails\"}">

Look at my awesome use of cfmail!
</cfmail>

More can be found in the Adobe Documentation

OTHER TIPS

This is what worked for me. The above suggestion threw errors.

<cfmailparam  
    name="X-SMTPAPI" 
    value='{"category":["Cool Emails"]}'>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top