Build the future of communications.
Start Building for Free

.NET posts

  • By Néstor Campos
    Use Razor Layouts in FluentEmail to reuse Headers and Footers Use Razor Layouts in FluentEmail to reuse Headers and Footers

    You can quickly and intuitively send emails using the FluentEmail library for .NET, but once you send many different emails in your project, you have to be able to organize your email templates in a good way to reuse content and enforce consistency in terms of format and design. Luckily, Razor Layouts can help you reuse parts of your templates like headers and footers.

    Prerequisites

    You will need the following for your development environment:

    You can find the source code of this tutorial in this GitHub repository.

    Set up an SMTP server

    To be able to send emails at scale, you'll need an email sending service like the SendGrid Email API, but for …

    Read More
  • By Similoluwa Adegoke
    How to build an Email Newsletter application using ASP.NET Core and SendGrid How to build an Email Newsletter using ASP.NET Core and SendGrid

    Sending out newsletters is a great way to keep your audience up-to-date on the latest news. There are existing newsletter products like SendGrid Email Marketing, however, in a scenario where the client demands more customization, building a newsletter app yourself using the SendGrid Email API is a great alternative.

    The advantage of building your own newsletter application is that you can control the nuts and bolts of the system and still maximize deliverability and measure engagement with SendGrid.

    In this tutorial, you will learn how to build a newsletter app using ASP.NET Core Razor Pages and SendGrid.

    Solution Overview

    Every newsletter application involves two parties: the subscriber of the newsletter, and the author of the newsletter.

    The subscriber's journey goes like this: The soon-to-be subscriber fills out a form to subscribe that includes their email address and other details (depending on your business needs). When the subscriber submits the …

    Read More
  • By Maarten Balliauw
    How to test ASP.NET Core Minimal APIs How to test  ASP.NET Core Minimal APIs

    How do you test that your ASP.NET Core Minimal API behaves as expected? Do you need to deploy your application? Can you write tests with frameworks like xUnit, NUnit, or MSTest?

    In this post, you will learn the basics of testing ASP.NET Core Minimal APIs. You’ll get started with testing a “hello world” endpoint, and then test a more complex API that returns JSON data. You’ll finish with customizing the ASP.NET Core service collection, so you can customize services for your unit tests and integration tests.

    By the end of this post, you will have a good understanding of how to make sure your ASP.NET Core Minimal APIs behave as expected and can be deployed to production, even on Fridays!

    Prerequisites

    Read More
  • By Niels Swimberghe
    .NETアプリケーションにデフォルト設定を適用する方法 .NETアプリケーションにデフォルト設定を適用する方法

    この記事はNiels Swimbergheこちらで公開した記事(英語)を日本語化したものです。

    過去に投稿したチュートリアル記事「TwilioとC#および.NETのアプリケーションをより良く構成する方法(英語)」と「SendGridとC#および.NETのアプリケーションをより良く構成する方法(英語)」では、Microsoft.Extensions.ConfigurationAPIを使用してアプリケーションの改善方法をご紹介しました。本稿では、これらのチュートリアルのテクニックを基に、デフォルトのオプションを設定の特定の場所に保存し、別の場所から上書きする方法をご紹介します。 例を挙げて説明します。アプリケーションから送るメールの種類は様々で、ウェルカムメール、パスワードリセットメール、オファーメールなどがあります。メールの種類によって、メールアドレスを使い分けたほうがよい場合もあります。「no-reply@yourdomain.tld」のように、返信不要のアドレスを使うことが多いですが、オファーメールでは受信者からの返信を受け取ることに大きな価値があることもあります。そこで、返信不要のアドレスを使う代わりに、返信を営業担当者に転送し、顧客関係管理(CRM)システムと自動的に統合されるようなメールアドレスを使うことができます。

    本稿では、デフォルトの返信用アドレスとして「no-reply@yourdomain.tld」を使用しますが、オファーメールでは、例えば「offers@yourdomain.tld」のように別のメールアドレスを使用します。

    必要事項 …

    Read More
  • By Niels Swimberghe
    Provide default configuration to your .NET applications Provide default configuration to your .NET applications

    In a previous post I shared how you can better configure your .NET applications for Twilio and SendGrid using the Microsoft.Extensions.Configuration APIs. In this tutorial, I'll build upon the techniques from those tutorials and you'll learn how to store default options in one section of your configuration and override them with specific options from another section. Let me clarify using an example. Applications often send different types of emails, like welcome emails, password reset emails, offer emails, etc. Depending on the type of email, you may want to send them from a different email address. For most emails, you may be using something like 'no-reply@yourdomain.tld', but for offer emails, the replies to the email could be of value. So instead of using the same no-reply address, you could use an email address that will be routed to a sales person and maybe automatically integrates with a Customer Relationship Management (CRM) …

    Read More
  • By Niels Swimberghe
    How to better configure C# and .NET applications for SendGrid How to better configure C# and .NET applications for SendGrid

    There are a hundred different ways to provide configuration to your applications. For almost any programming language, you can use environment variables and .env files, but configuration can also be stored in other file formats like JSON, YAML, TOML, XML, INI, and the list keeps on going. However, in some scenarios configuration isn't pulled from files, but instead is pulled from Azure Key Vault, HashiCorp Vault, or a similar vault service. It is rare that your configuration will come from a single source. Luckily, there are APIs in .NET that can help you grab configuration from multiple sources and merge them together.

    In this tutorial, you'll start with an application that sends emails using Twilio SendGrid, where the configuration is fetched directly from the environment variables. You'll then refactor the app to

    • fetch configuration from multiple sources, specifically, JSON files, user-secrets, environment variables, and command-line arguments
    • bind the configuration …
    Read More
  • By Néstor Campos
    How to send Emails in C# .NET with FluentEmail, Razor, and SendGrid How to send Emails in C# .NET with FluentEmail and SendGrid

    You can send emails with the .NET libraries that come with the framework such as the APIs from the System.Net.Mail namespace. They are suitable for this kind of development, however, sometimes you need a more straightforward and powerful way to generate and send emails.

    In this post, you will learn how to generate and send emails using the FluentEmail library connected with Twilio SendGrid in a console project with .NET.

    Prerequisites

    You will need a free Twilio SendGrid account and some experience with the C# language and .NET platform to complete this tutorial. Sign up here to send up to 100 emails per day completely free of charge.

    Finally, you will need the following for your development environment:

    Read More
  • By Niels Swimberghe
    How to better configure C# and .NET applications for Twilio How to better configure C# and .NET apps for Twilio

    There are a hundred different ways to provide configuration to your applications. For almost any programming language, you can use environment variables and .env files, but configuration can also be stored in other file formats like JSON, YAML, TOML, XML, INI, and the list keeps on going. Though, in some scenarios configuration isn't pulled from files, but instead is pulled from a service like Azure Key Vault, HashiCorp Vault, or a similar vault service. It is rare that your configuration will come from a single source. Luckily, there are APIs in .NET that can help you grab configuration from multiple sources and merge them together.

    In this tutorial, you'll start with an application that sends text messages using Twilio Programmable SMS, where the configuration is fetched directly from the environment variables. You'll then refactor the app to

    • fetch configuration from multiple sources, specifically, JSON files, user-secrets, environment variables, and …
    Read More
  • By Niels Swimberghe
    What's new in the Twilio helper library for ASP.NET (v5.73.0 - April 2022) What's new in the Twilio helper library for ASP.NET (v5.73.0 - April 2022)

    The Twilio helper library for ASP.NET (Twilio.AspNet) is a community-driven open-source project to make integrating Twilio with ASP.NET easier, for both ASP.NET Core and ASP.NET MVC on .NET Framework. The library helps you with very common use cases like:

    • Responding to Twilio webhook requests with TwiML objects from the official Twilio SDK for C# and .NET.
    • Binding data from Twilio webhook requests to strongly typed .NET objects.
    • Validating webhook requests originate from Twilio and rejecting them if not.

    As .NET and ASP.NET is evolving, the Twilio.AspNet contributors are enhancing the library to take advantage of the newest capabilities and best practices. So what's new?

    What's old in Twilio.AspNet

    Actually, before I share the shiny new additions, let me share what is already part of the library. After all, this is the first blog post to share news about the library.

    Handle Twilio webhook requests with ASP.NET

    In previous versions …

    Read More
  • By Niels Swimberghe
    How to Send SMS without a Phone Number using C# .NET and an Alphanumeric Sender ID Send SMS without a Phone Number using C# and Alphanumeric Sender ID

    You can quickly buy a phone number using Twilio's Super Network and then use that phone number to send and receive SMS. However, not all applications require two-way messaging. What's more, there are a lot of use cases where one-way messaging is a better fit, for example: notifications, alerts, and verifications. For these kinds of scenarios, you should consider using an Alphanumeric Sender ID.

    In this tutorial, you will learn how to send SMS messages from an Alphanumeric Sender ID with C#, .NET, and Twilio Programmable SMS; but first...

    What is an Alphanumeric Sender ID

    An Alphanumeric Sender ID (or Alpha Sender) lets you send SMS messages from a sender ID that consists of a set of alphanumeric characters, instead of from a phone number.

    The biggest benefit of using Alpha Sender is that you can use an ID that is more recognizable to your users than a …

    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.