Skip to content

ErrorCode 403 : Invalid request field(s): $.Metadata #113

@tflight

Description

@tflight

Hi,

I've been getting this error when sending some emails. The emails which it fails on seem fairly random, though it occurs more commonly with some types of emails than others.

{"ErrorCode":403,"Message":"Invalid request field(s): $.Metadata"}

I've read this article on Changes to Email API validation and it seems related. I am using the postmark_metadata filter in my emails. So I'm unsure if I'm doing something incorrect or if the plugin should be updated to do additional validation before sending along the email.

// Support using a filter to set metadata on a message
if ( has_filter( 'postmark_metadata' ) ) {
$body['Metadata'] = apply_filters( 'postmark_metadata', array() );
}

I'm using the filter like this:

add_filter('postmark_metadata', 'cc_postmark_metadata');
function cc_postmark_metadata($metadata)
{
    if (isset($_SERVER['REMOTE_ADDR'])) {
        $metadata['remote_ip'] = $_SERVER['REMOTE_ADDR'];
    }

    return $metadata;
}

I've turned off this filter for now to make sure this is where the issue is coming from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions