Skip to content
r-a-y edited this page Jan 21, 2019 · 4 revisions

As of v1.0-RC4, RBE supports SparkPost as an inbound provider.

For more on inbound email, read the corresponding ticket - https://github.com/r-a-y/bp-reply-by-email/issues/46.

This guide requires knowledge of how to send POST requests via either cURL or using an app like Postman to communicate with the SparkPost API.

If you are not a developer, please choose a different inbound provider listed in the Starter Guide.


Things we're going to do:

  1. Create an account at sparkpost.com and an API key.
  2. Set up a new subdomain that is used exclusively by SparkPost. eg. reply.example.com.
  3. Add SparkPost's MX records to this subdomain.
  4. In SparkPost, register the subdomain.
  5. In SparkPost, register the webhook.
  6. Install the master branch of RBE (1.0-RC4 or later) and add the subdomain to RBE's settings page.

SparkPost also has their own help article that you can also refer to for steps 1-5:
https://support.sparkpost.com/customer/portal/articles/2039614-enabling-inbound-email-relaying-relay-webhooks


Installation instructions:

1) Create an account at sparkpost.com and an API key.

Create an account at SparkPost.

You'll need to complete the entire "Getting Started" section after you have registered your account. A detailed guide can be found here:
https://www.sparkpost.com/docs/getting-started/getting-started-sparkpost


IMPORTANT: If you do not plan on sending email with SparkPost, you still need to create and verify a sending domain as well as sending out at least one email with SparkPost per month in order to keep your account active


Once you have created your account, we need to create a dedicated API key for inbound email:

  1. Login to the SparkPost dashboard.
  2. Go to Account > API Keys.
  3. Click on New API Key.
  4. Under API Key Name, give it a name that you can identify with your site.
  5. Under API Permissions, select:
    • Inbound Domains: Read/Write
    • Relay Webhooks: Read/Write
  6. Save by clicking on Add API Key.
  7. This will show your API key. Make sure you save this key so we can reference it later as SparkPost only shows the API key once.

2) Create a subdomain at your domain registrar's dashboard

Login to your domain registrar's dashboard and create a new subdomain.

Let's say example.com is your WordPress site, you'll want to create a dedicated subdomain used only by SparkPost. eg. reply.example.com. Change reply to whatever suits your fancy. This will be used in emails for the Reply-To email header - [email protected] - so choose carefully.


3) Add SparkPost's MX records for your new subdomain

SparkPost requires the following MX records to be set for your subdomain:

  • rx1.sparkpostmail.com - priority 10
  • rx2.sparkpostmail.com - priority 10
  • rx3.sparkpostmail.com - priority 10

Quoted from https://developers.sparkpost.com/api/#/reference/inbound-domains

Configure your subdomain to use these records in your domain registrar's dashboard.


4) In SparkPost, register the subdomain.

As of writing, SparkPost does not have a UI in their dashboard to register a subdomain.

  1. Ensure that you are familiar with the SparkPost API:
    https://developers.sparkpost.com/api/index.html

    Particularly, setting the Authorization header to the API key we created in step 1.

  2. Use the following API call:
    https://developers.sparkpost.com/api/inbound-domains.html#inbound-domains-create-and-list-post


5) In SparkPost, register the webhook.

As of writing, SparkPost does not have a UI in their dashboard to register an inbound domain webhook.

  1. Ensure that you are familiar with the SparkPost API:
    https://developers.sparkpost.com/api/index.html

    Particularly, setting the Authorization header to the API key we created in step 1.

  2. Use the following API call (all parameters are required):
    https://developers.sparkpost.com/api/relay-webhooks.html#relay-webhooks-create-and-list-post

    • For the name field, type in a name that you can identify with your site.
    • For the target field, type in the URL to your WordPress install.
    • For the auth_token field, type in a unique passphrase. This can be used to verify that POST responses are coming from SparkPost.
    • For the domain field, enter the subdomain you created in step 2.

(optional) If you entered an auth_token in point 2, open wp-config.php and add the following line:

define( 'BP_RBE_SPARKPOST_WEBHOOK_TOKEN', 'THE STRING YOU ADDED FOR AUTH_TOKEN' );

This will increase security to ensure that webhook responses were actually sent from SparkPost.


6) Install and configure RBE on your WordPress site
  1. Download the latest master branch of RBE - https://github.com/r-a-y/bp-reply-by-email/archive/master.zip
  2. Extract the plugin to /wp-content/plugins/.
  3. Login to the WP admin dashboard and activate RBE. Next, navigate to BuddyPress > BP Reply By Email.
  4. Do the following:
    • For Mode, select Inbound Email.
    • For Provider, select SparkPost.
    • For Inbound Domain, type in the subdomain in step 2. Save the settings.
  5. Now test out RBE! At-mention someone on the frontend and try to reply to that person via email. See if a reply is sent back. If you are able to reply to one another, RBE is working!