• Hi there,

    I’m triggering a webhook to send an email and keep getting the following error:

    Uncaught Error: Class 'SendGrid\Mail\Mail' not found in ~/wp-content/plugins/post-smtp/Postman/Postman-Mail/PostmanSendGridMailEngine.php:47

    I have a URL that has basic code:

    $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
    require_once( $parse_uri[0] . 'wp-load.php' );
    wp_mail( 'myemail@example.com', 'TEST SUBJECT', 'TEST BODY',null,null);

    For some reason, that wp_mail function is throwing the error. I’m wondering if somehow SendGrid Class is getting loaded to soon.

    When I run the following to test that I can call WP functions, it works

    if (function_exists('wp_create_user')) {
        echo "wp_create_user() found";
    }

    Thanks in advaance!

    • This topic was modified 3 years, 10 months ago by dornstudio.
Viewing 1 replies (of 1 total)
  • I’m not familiar with your code, but maybe this will work:

    $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
    require_once( $parse_uri[0] . 'wp-load.php' );
    add_action( 'plugins_loaded', function() {
        wp_mail( 'myemail@example.com', 'TEST SUBJECT', 'TEST BODY',null,null);
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Uncaught Error: Class ‘SendGrid\Mail\Mail’ not found’ is closed to new replies.