Support » Plugin: SparkPost » Missing parameters

  • Hi,

    When using a Enterprise Sparkpost subscription, wee need to set the return_path. See the Sparkpost message:

    return_path string SparkPost Enterprise API only: email to use for envelope FROM required for email transmissions To support Variable Envelope Return Path (VERP), this field can also optionally be specified inside of the address object of a specific recipient in order to give the recipient a unique envelope MAIL FROM.

    In addition, I also need to set the endpoint: https://developers.sparkpost.com/api/. However, this endpoint is fixed in the current code.

    Unfortunately, the only option I have is to edit the plugin code directly which is not suitable for support and updates.

    Would is be possible to have, in the plugin parameters the following options?
    * API Endpoint (required for an Enterprise subscription)
    * Return-path (required for an Enterprise subscription)
    * Campaign ID (ideal for tracking campaign)
    * ip_pool (ideal for setting an IP pool)

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor rajuru

    (@rajuru)

    You should be able to solve all of these problem using one or more hook(s).

    https://github.com/SparkPost/wordpress-sparkpost/blob/master/docs/hooks.md

    Hi rajuru,

    It sounds probably obvious for you, but it is not for me.
    My objective is to improve the setting page to allow the site administrator to set the parameters (Endpoint, Return-Path, Campaign ID, IP Pool). I don’t see how to do that thanks to the hooks.
    Could you provide one or more example, please?

    Thank you

    • This reply was modified 2 years, 9 months ago by fabscanta.
    Plugin Contributor rajuru

    (@rajuru)

    Thanks for your specific suggestions. However, settings page is for most generic use cases. Having those extra fields in the settings page may even confuse the non-enterprise users. However, if we see a growing demand for this, we can surely consider that.

    You can see this buddyfix example how to use a hook.

    In the same way, you can use any of the appropriate hook listed in the previous link. For example, you can customize the whole payload (data sent to sparkpost), using wpsp_request_body hook.

    add_filter('wpsp_request_body', function($body){
        //you can modify anything in $body here
    });

    you can customize the payload as transmission api supports.

    and to modify the endpoint, you can use

    add_action('wpsp_init_mailer', function($obj) {
      $obj->endpoint = 'YOUR_API_ENDPOINT_HERE';
    });
    • This reply was modified 2 years, 9 months ago by rajuru.
    • This reply was modified 2 years, 9 months ago by rajuru.
    • This reply was modified 2 years, 9 months ago by rajuru.

    I think this is more valuable for the plugin to support Enterprise users.

    I tried your suggestion for the endpoint. I get a fatal error because $obj->endpoint is protected.
    Error: Cannot access protected property WPSparkPost\SparkPostHTTPMailer::$endpoint

    We thought that there is a field to do a fork and a pull request where you could review the code and validate it.

    Do you think your team could welcome this option as an opportunity of improvement?

    Thank you

    Plugin Contributor rajuru

    (@rajuru)

    Error: Cannot access protected property WPSparkPost\SparkPostHTTPMailer::$endpoint

    Ah, that’s a super silly oversight! It must not be protected. I’ve just logged a bug. We’ll fix it ASAP.

    Do you think your team could welcome this option as an opportunity of improvement?

    Sure. We log all enhancement ideas. Please create an issue in https://github.com/SparkPost/wordpress-sparkpost/issues. We’ll surely consider it based on demand.

    Hi rajuru,

    That’s great to read your feedback.

    My colleague has made the pull request: https://github.com/SparkPost/wordpress-sparkpost/pull/105

    Many thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Missing parameters’ is closed to new replies.