C#和SparkPost的入门

C#和SparkPost的入门

C#和SparkPost的入门

Sep 13, 2017

出版商

出版商

迈克-希利尔

迈克-希利尔

-

类别

类别

C#和SparkPost的入门

C#和SparkPost的入门

Ready to see Bird
in action?

Ready to see Bird
in action?

Getting Started with C# and SparkPost

有一种更好的方法可以在C#中发送电子邮件

发送电子邮件是C#应用程序的一个非常普遍的需求。想一想几乎每个应用程序都需要处理的一些用例:新用户欢迎、事件通知、密码重设等等。这些事务性的电子邮件是工作的主力,把它们送到你的用户手中真的很重要。作为一个C#开发者,什么是完成这些工作的最佳方式?


目前有多个 C# 电子邮件库,包括 system.net.mail、systems.web.mail.SmtpClient、MailKit、MimeKit 等。SmtpClient、MailKit、MimeKit 等,但它们都有一个共同点:使用它们需要一个 SMTP 服务器。即使您可以访问服务器,它也可能无法确保您的邮件快速、稳定地发送到用户的inbox 。使用 SparkPost 电子邮件发送服务是一种更简单的方法。


让我们试一试吧。下面是如何使用SparkPost和C#来发送消息。


你好,世界!我正在用C#和SparkPost发送电子邮件

ǞǞǞ first step in sending email using C# with SparkPost is to 注册一个SparkPost开发者账户 and get your sending domain configured. Follow our 入门指南 to get your account set up right with a sending domain. I’ll wait right here.


With your account set up, your sending domain configured, and your API key in hand, you’re ready to send your first email using C#. Create an application and install Sparkpost Nuget package from your Nuget 软件包管理器控制台:




就是这样!启动应用程序,你应该会在inbox 中看到一条测试信息。最棒的是什么?你不需要管理任何服务器、监控任何服务,也不用担心邮件是否会到达收件人手中。您只需决定发送内容和发送对象,其余的就交给 SparkPost 吧。


请继续关注更多的C#电子邮件技巧

由于一个简单的API,你已经在成为一个C#电子邮件大师的路上了。你有一个可用的发送域,你已经发送了你的第一封邮件,很快你就能征服电子邮件世界了


这就是说,你的旅程还没有完成。你真的想通过用代码建立你的电子邮件模板来结合内容和设计吗?当然不是!你会发现,你所做的一切都很好。请继续关注,我将向你展示如何将邮件内容从你的API调用中分离出来,并预存邮件模板,进一步简化你的代码。


Till then, 报名参加SparkPost, 设置你的域名, and check out our 伟大的API文档! If you have any other questions around C# and SparkPost, come 到 #csharp channel in our 社区松弛.

- 邓小平

Your new standard in Marketing, Pay & Sales. It's Bird

ǞǞǞ right message ->right person ->right time.

By clicking "See Bird" you agree to Bird's 隐私声明.

Your new standard in Marketing, Pay & Sales. It's Bird

The right message -> to the right person ->right time.

By clicking "See Bird" you agree to Bird's 隐私声明.