Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tflight opened this issue Mar 7, 2024 · 0 comments
Open

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

tflight opened this issue Mar 7, 2024 · 0 comments

Comments

@tflight
Copy link
Contributor

tflight commented Mar 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant