我只需要验证发送域和 API 密钥

I need to verify only Sending Domain and API Key

我只需要验证发送域和 API 密钥。现在我用这个 curl:

curl \
-H "Content-Type: application/json" \
-H "Authorization: <REPLACE_WITH_YOUR_API_KEY>" \
-X POST -d '{"options":{"open_tracking":true,"click_tracking":true},"metadata":{"some_useful_metadata":"testing_sparkpost"},"substitution_data":{"signature":"<REPLACE_WITH_YOUR_FIRST_AND_LAST_NAME>"},"recipients":[{"address":{"email":"<REPLACE_WITH_YOUR_EMAIL_ADDRESS>"},"tags":["learning"],"substitution_data":{"customer_type":"Platinum","first_name":"<REPLACE_WITH_YOUR_FIRST_NAME>"}}],"content":{"from":{"name":"Awesome Company","email":"testing@<REPLACE_WITH_YOUR_SENDING_DOMAIN>"},"subject":"My first SparkPost Transmission","text":"Hi {{first_name}}\r\nYou have just sent your first email through SparkPost!\r\nCongratulations,\r\n{{signature}}","html":"<strong>Hi {{first_name}},</strong><p>You have just sent your first email through SparkPost!</p><p>Congratulations!</p>{{signature}}"}}' \
https://api.sparkpost.com/api/v1/transmissions

这个 url 给我发了一封电子邮件所以它是正确的,但我必须使用 url 不发送电子邮件但验证 API 密钥和发送的正确性领域。谁能帮帮我?

听起来您想验证两件事:

  1. 您的 API 密钥能够发送传输(电子邮件)
  2. 您可以使用您的发送域发送

为此,您可以使用与问题中相同的 cURL 命令,但将 .sink.sparkpostmail.com 附加到域的末尾。如果您的 API 密钥和发送域正确,那将 return 200 但不会发送电子邮件(但是发送仍将计入您的使用)。您可以阅读有关天坑的更多信息 here.

或者,您可以使用 the Sending Domains page or Sending Domains API to see the status of your domain. You can use the Credentials page 验证您的 API 密钥是否具有 "Transmissions: Read/Write" 权限