使用 Mailgun 使用 Javascript 发送电子邮件

问题描述 投票:0回答:1

我正在使用 JS,我有以下代码:

  var XHRResponse = XHR.send("POST", "https://api.mailgun.net/v2/sandbox224f28ae45a8499d84184fd4c48e62ee.mailgun.org/messages",{
    "parameters": {
      "from": "Mailgun Sandbox <[email protected]>",
      "to": "Jordi <[email protected]>",
      "subject": "Hello Jordi",
      "text": "Congratulations Jordi, you just sent an email with Mailgun!  You are truly awesome!  You can see a record of this email in your logs: https://mailgun.com/cp/log .  You can send up to 300 emails/day from this sandbox server.  Next, you should add your own domain so you can send 10,000 emails/month for free."
    }
  }); 

我需要使用 apikey 进行身份验证,但我不知道在哪里以及如何进行身份验证。

谢谢

javascript rest sendmail mailgun
1个回答
10
投票

Mailgun API 文档包含所有这些信息。具体查看“身份验证”部分,https://documentation.mailgun.com/docs/mailgun/api-reference/authentication/。然而话虽这么说,如果他们(如果我理解正确的话)要求密钥以纯文本形式编写,我就不会在客户端中运行它。

© www.soinside.com 2019 - 2024. All rights reserved.