There’s a Better Way to Send Email in C#

Sending email is a very common need for C# applications. Think about some of the use cases almost every app needs to handle: new user welcomes, event notifications, password resets, and so on. These transactional emails are workhorses, and it’s really important that they get to your users. As a C# developer, what’s the best way to get them done?

There are several C# email libraries out there, including system.net.mail, systems.web.mail. SmtpClient, MailKit, MimeKit, etc., but they all have one thing in common: you need an SMTP server to use them. Even if you have access to a server, it’s probably not tuned to ensure your messages get to your user’s inbox quickly and consistently. Using the SparkPost email delivery service is an easier way.

Let’s give it a try. Here’s how to send a message using SparkPost and C#.

Hello, World! I’m Sending Email with C# and SparkPost

The first step in sending email using C# with SparkPost is to sign up for a SparkPost developer account and get your sending domain configured. Follow our Getting Started Guide 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 Package Manager Console:

With SparkPost installed, we can format and send our first C# email message:

And that’s it! Launch the application and you should see a test message in your inbox. And the best part? You don’t have to manage any servers, monitor any services, or worry about whether the message will reach its recipient. You take care of deciding what to send and to whom, and SparkPost takes care of the rest.

Stay Tuned for More C# Email Tips

You’re well on your way to being a C# email master, thanks to one simple API. You have a working sending domain, you’ve sent your first message, and soon you will conquer the email world!

That said, your journey is not yet complete. Do you really want to have to combine content and design by building your email templates in code? Of course not! Stay tuned and I will show you how to separate the content of the message out of your API call and pre-store the message template, simplifying your code even further.

Till then, sign up for SparkPost, set up your domain, and check out our great API documentation! If you have any other questions around C# and SparkPost, come to the #csharp channel in our community slack.

— Mike

Triggered-Email-questions

What to Ask Before Implementing a Triggered Email Program

You’ve been digging into triggered email questions. You’ve learned the basics of triggered emails, mastered the triggered emails every retailer needs, and discovered the secrets of some really innovative triggered emails. What now? If you’re revved up to go, just ask yourself one question: is triggered email a fit for your business?

Well, I’m not going to equivocate. If you’re sending list-based marketing email, you should be sending triggered email as well. The growing ubiquity and affordability of cloud-based marketing automation platforms means the technical and cost barriers to entry have made triggered emails accessible to senders of every size—and no successful competitor is going to stand still.

That’s not to say it’s time to start throwing the switches, levers, and triggers without forethought. Triggered email is a powerful tool for nurturing customer engagement—and with great power comes great responsibility. Here are five triggered email questions you should consider before implementing your program:

  1. Have you optimized your existing email programs? From frequency to design, there may be ways to wring more out of your present efforts, even if you’re committed to a triggered email option.
  2. Who will oversee implementation? It should be a marketing responsibility, rather than IT. So make sure you have a clear understanding of who will manage the program, and give them a voice in picking the right platform to pull it off.
  3. Should you set frequency caps? There’s a hinge point at which a marketer’s emails can move from “informative” to “annoying.” So be sure to tread carefully here; test and re-test, as necessary. And be sure to consider the frequency generated by all your emails, not just the triggered ones: consumers certainly don’t discriminate between them.
  4. Do you have measurement and analytics procedures in place? There can be many adjustments involved in a triggered program. You may want to calculate how many purchases you would have gotten with versus without specific triggered emails, for instance. Or what your shopping cart retrieval rate was, and how it translated into revenue.
  5. How do I stand out from the competition? If others can use triggered email, they probably will. How can your branding and messaging help you? How might your sending times and trigger rules figure into this?

Turning Triggered Email Questions to Action

By putting the right information in front of that person at the right time, triggered email can garner very positive short-term outcomes while nurturing customer engagement over the long term. There are few stronger examples of win-win in email marketing. If your business depends upon customer engagement, triggered emails could be just the strategic tool you need.

What are some of best practices you’ve developed for implementing triggered email? I’d love to hear the questions you asked—and the answers that resolved them.

—Brent
@brentsleeper

P.S. Do you have more triggered email questions? Check out my guide, “Getting Started with Triggered Email,” for a great introduction.

Triggered-Guide_Dev-Blogs_600x200_0816

GettingStartedWithSP_350x250Six months in and WOW I am learning a lot. Who knew email had so much going on behind the scenes? Coming from a world outside of email, there is a large transition, but surprisingly not too difficult to understand. There are terms and flows that I had no idea existed before joining the email world.

If you are new to email as I am, there are some things you should know.

First things first, here are some things to think about.

  1. Are you sending transactional email or marketing email? If you are sending transactional emails this can be considered as a part of doing business so you may not need opt-in consent. If you are sending marketing emails you will need the recipients to opt-in or your emails could be considered SPAM.
  2. Are you sending out immediately or scheduling a “bulk send”? Think about sending limits. Your “bulk send” amount could go over your sending limit.
  3. Make sure you are sending expected content. This could include the copy for your ‘password resets’ to the content of your newsletter. Newsletters should contain something that’s relevant to your audience and in line with expectations for when they signed up for your newsletter. If you said you’d send company news once a month, you shouldn’t start sending promotions once a week. That will generate spam complaints and poor deliverability. Deliverability consists of all the issues involved in getting your emails delivered to the expected recipient. Unexpected content could cause poor deliverability and block your email from being delivered.
  4. Next step is to set-up your sending domains. Sending domain is used to identify you as a sender, helps you build a sending reputation with ISPs for better inbox placement, and allows you to send more messages on our system. Find out more about how to set-up your sending domain here.
  5. You will also need a Template. A template defines the body of your email. It is also the place to define where substitution data will go in your emails. Find out more about creating a template here.
  6. Finally, you will need is a recipient list. Recipient list is a list of email address you want your emails delivered to. Again, make sure you get Opt-in permission from your recipients. You should not add people to your list that have not opted-in. This can affect your deliverability. More information on setting up recipient lists is found here.

You can also set-up email using SMTP. Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (email) transmission. Here is a video to explain sending via STMP:

If you are sending via SMTP or Rest APIs you will need an API Key. The API key is used to authenticate you acting on behalf of your account from tools outside of SparkPost. Steps to create and API key are here:https://support.sparkpost.com/customer/portal/articles/1933377?b_id=7411

This is a good head start, but there is much more to talk about. I will follow-up with more information in a later blog. Look out for it soon. I have a lot more to talk about. It will include some things to be aware of. Happy emailing!

~Nichelle