什么是SparkPost?

I’ve used Mandrill for as long as I can remember. It sends transactional email, like the kind you receive when you sign up for a new account. Like me, many have been happy to use a free account for sending a relatively low number of emails a month.

我已经使用Mandrill了很久。 它会发送交易电子邮件,就像您注册新帐户时收到的电子邮件一样。 像我一样,许多人很乐意使用一个免费帐户每月发送相对较少的电子邮件。

Mail flying off

That is, until recently, when Mandrill caused a bit of a stir. The heart of the matter is that Mandrill removed their free tier. Anybody wishing to send mail through Mandrill now requires a paid-for MailChimp account.

也就是说,直到最近,Mandrill引起了一些轰动。 问题的核心是Mandrill取消了他们的免费套餐。 现在,任何希望通过Mandrill发送邮件的人都需要一个付费的MailChimp帐户。

Perhaps they grew tired of making no money for sending lots of emails. Whatever the reason, many folks were surprised, and some even angry at the move. It’s akin to a popular open source library suddenly going closed-source.

也许他们厌倦了不赚钱发送大量电子邮件。 无论出于什么原因,许多人都感到惊讶,甚至有些人对此举动感到愤怒。 这类似于一个流行的开放源代码库突然变成了封闭源代码。

什么是SparkPost? (What is SparkPost?)

Mindful that people are looking for alternatives (to power their personal newsletters or whatever), I spoke to Aydrian Howard. Aydrian is the Developer Advocate at SparkPost, whom I met at FluentConf. We talked for a bit about SparkPost and what makes it different from MailChimp…

考虑到人们正在寻找替代方法(以增强他们的个人新闻通讯或其他功能),我与艾德良·霍华德交谈。 Aydrian是在开发人员倡导者SparkPost ,就是我在FluentConf满足。 我们讨论了一些有关SparkPost的内容,以及与MailChimp的不同之处……

1.您对最近的MailChimp / Mandrill新闻有何看法? (1. What are your thoughts on the recent MailChimp/Mandrill news?)

We have a lot of respect for MailChimp and think they are a great company. We understand when they say that transactional email isn’t the business they’re in. Thanks to our great relationship with MailChimp, they are recommending us as a Mandrill replacement.

我们非常尊重MailChimp,并认为他们是一家伟大的公司。 当他们说交易电子邮件不是他们从事的业务时,我们会明白。由于我们与MailChimp的良好关系,他们建议我们将其作为Mandrill的替代产品。

2.服务开展了多长时间了,目的是什么? (2. How long has the service been around, and what is its purpose?)

We got our start in the late 1990s when Message Systems launched Momentum, the high-performance messaging platform servicing high-volume senders. Over time the Momentum customer base grew to send over 25% of all legitimate email and saw the launch of a managed cloud offering. In 2014 we launched SparkPost, providing developers with the same deliverability, scalability and speed as we provide to the biggest senders in the world, in an easily integrated cloud service.

我们从1990年代末开始,当时Message Systems推出了Momentum,这是为高流量发件人提供服务的高性能消息传递平台。 随着时间的流逝,Momentum客户群逐渐发送了超过25%的合法电子邮件,并见证了托管云产品的推出。 2014年,我们推出了SparkPost,通过易于集成的云服务为开发人员提供与向世界上最大的发件人提供的相同的可交付性,可伸缩性和速度。

3. Mandrill和SparkPost有什么共同点? (3. What do Mandrill and SparkPost have in common?)

We’re both SMTP & API-driven email infrastructure services.

我们都是SMTP和API驱动的电子邮件基础结构服务。

4.使用SparkPost可以做什么,而不能使用Mandrill可以做什么? (4. What can you do with SparkPost that you can’t with Mandrill?)

With SparkPost, you have the ability to use a single platform to send all your bulk and transactional messages. That means a single API, templating language, tracking, metadata and metrics. We are the industry’s leading email delivery service with nearly 98% inbox placement, which is 15 points higher than the industry average. We also provide to the minute tracking data (versus hourly) across all of our 35+ metrics. As part of our commitment to transparency, we include delivery latency numbers in our metrics. We are highly focused on developers. We maintain 8 client libraries (so far) and a growing selection of integrations. Our developer community is a very important part of SparkPost. We like to encourage and enable everyone to build something awesome.

使用SparkPost,您可以使用单个平台发送所有批量和事务性消息。 这意味着一个单一的API,模板语言,跟踪,元数据和指标。 我们是业界领先的电子邮件传递服务,收件箱放置率接近98%,比行业平均水平高15点。 我们还提供所有35多个指标的分钟跟踪数据(相对于每小时)。 作为我们对透明度的承诺的一部分,我们在指标中包括了传递延迟数。 我们高度专注于开发人员。 到目前为止,我们维护着8个客户端库以及越来越多的集成选择。 我们的开发人员社区是SparkPost的重要组成部分。 我们希望鼓励并使每个人都能建立很棒的东西。

5. SparkPost定价如何工作? (5. How does SparkPost pricing work?)

We just published a great FAQ Blogpost on our pricing.

我们刚刚发布了一个关于定价的常见问题解答博客文章

使用SparkPost (Using SparkPost)

After talking to Aydrian, I decided to try SparkPost. Turns out it’s quite easy to set up! To use it, you have to create an account:

与Aydrian交谈之后,我决定尝试SparkPost。 事实证明,设置非常容易! 要使用它,您必须创建一个帐户:

SparkPost home screen
SparkPost Registration Screen

When you first register, you’ll be presented with a couple of steps to set up your first application.

首次注册时,将向您提供几个步骤来设置您的第一个应用程序。

Setting up an application, step 1 - selecting the domain from which to send
Setting up an application,  step 2 - selecting whether the user wants STMP or REST

You can choose to send mail through SMTP or the JSON API. Click “Get a key” and keep that key close at hand for the code we’re about to write.

您可以选择通过SMTP或JSON API发送邮件。 单击“获取密钥”,并将该密钥放在附近以备我们要编写的代码。

Next, create a working directory, and download the official SparkPost PHP SDK:

接下来,创建一个工作目录,并下载官方的SparkPost PHP SDK:

composer require sparkpost/php-sparkpost

You might see a warning about outdated dependencies. The SDK maintainers know about this and are working on a new version.

您可能会看到有关过时依赖关系的警告。 SDK维护人员对此有所了解,并正在开发新版本。

Create a config.php file, to store the key:

创建一个config.php文件,以存储密钥:

return [
    "sparkpost" => [
        "key" => "<your key here>",
    ],
];

It’s a good idea to ignore this file in Git, so create a .gitignore. It’s also a good place to ignore other common files:

在Git中忽略此文件是一个好主意,因此请创建.gitignore 。 这也是忽略其他常见文件的好地方:

config.php
vendor/

Now, let’s create send.php, to send emails through SparkPost:

现在,让我们创建send.php ,以通过SparkPost发送电子邮件:

require("vendor/autoload.php");

use SparkPost\SparkPost;
use GuzzleHttp\Client;
use Ivory\HttpAdapter\Guzzle6HttpAdapter;

$config = require("config.php");

$adapter = new Guzzle6HttpAdapter(new Client());

$client = new SparkPost($adapter, [
    "key" => $config["sparkpost"]["key"],
]);

$results = $client->transmission->send([
    "from" => "Sandbox <sandbox@sparkpostbox.com>",
    "html" => "<html><body>hello html email</body></html>",
    "text" => "hello plain text email",
    "subject" => "Testing SparkPost Email",
    "recipients" => [
        [
            "address" => [
                "name" => "Chris",
                "email" => "cgpitt@gmail.com",
            ],
        ],
    ],
]);

The official PHP SDK requires an adapter library called Ivory\HttpAdapter. This abstracts the HTTP layer, so that you can swap from GuzzleHttp to something else. This is probably just to cater for folks stuck on PHP 5.4, who can’t use the latest and greatest version of Guzzle.

官方PHP SDK需要一个名为Ivory\HttpAdapter的适配器库。 这将抽象HTTP层,以便您可以从GuzzleHttp交换到其他内容。 这可能只是为了迎接那些无法使用最新,最好版本的GuzzlePHP 5.4使用者。

With the adapter, we then create an instance of the SparkPost client. On this we can access the transmission property and the send method.

然后,使用适配器,我们创建SparkPost客户端的实例。 在此我们可以访问transmission属性和send方法。

结论 (Conclusion)

The properties here are only a fraction of what you can specify through the JSON API. I am curious to see how easy it would be to use that directly, but hopefully this illustrates how to begin to use SparkPost, with minimal effort.

这里的属性只是您可以通过JSON API指定的内容的一小部分。 我很想知道直接使用它会多么容易,但是希望这说明了如何以最小的努力开始使用SparkPost。

Stay tuned for more on this topic, as we explore how to use the SparkPost API to do more interesting things. Let us know if you’re interested in integrating SparkPost into your application or favorite framework, in the comments below.

请继续关注该主题,我们将探索如何使用SparkPost API来做更多有趣的事情。 在下面的评论中,让我们知道您是否有兴趣将SparkPost集成到您的应用程序或喜欢的框架中。

翻译自: https://www.sitepoint.com/what-is-sparkpost/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值