0

No Account or Server API tokens were supplied in the HTTP headers. Please add a header for either X-Postmark-Server-Token or X-Postmark-Account-Token. i'm trying this code but get above error!

cfset emailSettings = {
    to = "f2020266005@umt.edu.pk",
    from = "ben+from@bennadel.com",
    subject = "PostMark Bounce Back Testing",
    htmlBody = "<strong>All your emails are belong to us!</strong>"
    } />

<!--- Post the email to the PostMark server. --->
<cfhttp
    result="post"
    method="post"
    url="http://api.postmarkapp.com/email">

    <!---
        Alert the server that the we can accept JSON as the type of
        data returned in the response.
    --->
    <cfhttpparam
        type="header"
        name="accept"
        value="application/json"
        />

    <!---
        Alert the server that the email content will be serialized
        in the post body as JSON text.
    --->
    <cfhttpparam
        type="header"
        name="content-type"
        value="application/json"
        />

    <!--- Define the API key to authorize post. --->
    <cfhttpparam
    name="Authorization"
    type="header"
    value="Bearer [my_api_key]"
    />

    <!---
        Post the serialized JSON email properties as the HTTP
        message body.
    --->
    <cfhttpparam
        type="body"
        value="#serializeJSON( emailSettings )#"
        />

</cfhttp>


<!--- Output the post response (returned in JSON format). --->
<cfdump
    var="#deserializeJSON( post.fileContent )#"
    label="PostMark CFHTTP Response"
    />

expecting to get no error but this code give error in third

cfhttpparam tag 

0 Answers0