Build the future of communications.
Start building for free

.NET posts

  • 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 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
  • By Niels Swimberghe
    SendGrid APIを使用し、C#と.NET 6でメールを送信する方法 SendGrid APIを使用し、C#と.NET 6でメールを送信する方法

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

    メールは何十年も前から存在していますが、メールを大規模に送信することはいまだ困難です。Twilio SendGridなら、スケーラビリティを気にすることなくメールを送信できます。さらに、SendGridのAPIとSDKを使えば、数分でメール送信を開始できます。

    また、SMTPを基盤とする既存のコードベースがある場合は、SMTPプロトコルを使用することもできます。本稿では、SendGrid .NET SDKと.NET 6コンソールアプリケーションを使用してメールを送信する方法をご紹介します。

    必要条件

    チュートリアルを進めるには、以下の項目が必要です。

    • .NETをサポートするOS(Windows/Mac/Linux)
    • .NET 6 SDK(ダウンロード)
    • コードエディタまたはIDE(推奨: C#プラグインを導入したVS Code、Visual Studio、JetBrains Rider)
    • Twilio SendGridのアカウント(登録はこちらから)

    .NET(Core)の古いバージョンを使用している場合でも、本稿の手順を進めることができます。ただし、わずかな調整は必要となります。

    SendGridアカウントでメールを送信するための設定

    メールを送信する前に設定する項目が2つあります。

    1つ目は、Sender Authentication(送信者の認証)の設定です。送信者の認証は、送信者がメールを送信するメールアドレスまたはドメインを所有していることを確 …

    Read More
  • By Néstor Campos
    Organize Incoming Email Attachments with C# and ASP.NET Core using Twilio SendGrid Inbound Parse Organize Incoming Email Attachments with C# and ASP.NET Core using Twilio SendGrid Inbound Parse

    At times, people in many organizations must organize and associate files (such as accounts, invoices, and more) with each employee or vendor in the company. Generally, these files arrive by email to a default mailbox that is constantly monitored, but manually. In this post, you are going to learn how to organize and associate files that users send by email to a particular mailbox through Twilio SendGrid with an API built in ASP.NET.

    Prerequisites

    To complete this tutorial, you will need a free Twilio SendGrid account and experience working with ASP.NET applications using the C# language. Sign up here to send up to 100 emails per day completely free of charge.

    Additionally, the API that you are going to create needs to be publicly exposed to be accessed from Twilio SendGrid, in this tutorial you will use ngrok to test your application without the need to deploy it in …

    Read More
  • By Niels Swimberghe
    How to prevent email HTML injection in C# and .NET How to prevent email HTML injection in C# and .NET

    Every few years, the Open Web Application Security Project (OWASP) publishes a new list of the 10 most common security issues in web applications, called OWASP Top 10. There is one security flaw that has been around since the first edition in 2003, and grabbed the first spot in the 2010, 2013, and 2017 editions, and that security issue is vulnerability to injection attacks. I previously talked about injection attacks in general and more specifically, how dangerous email HTML injection attacks are and how you can prevent them. However, in this post, you'll learn how you can mitigate HTML injection attacks in .NET specifically.

    How HTML injection into emails work

    HTML injection is a vulnerability where an application accepts user input and then embeds the input into HTML. A malicious user can inject HTML through the user input so that their malicious HTML is embedded into …

    Read More
  • By Niels Swimberghe
    How to send ASP.NET Core Identity emails with Twilio SendGrid Send ASP.NET Core Identity emails with Twilio SendGrid

    As part of ASP.NET Identity, ASP.NET Core provides a bunch of features for account management, authentication, and authorization. ASP.NET Identity also sends emails to confirm email addresses and reset passwords, but it's up to you to implement how those emails are sent.

    In this tutorial, you will learn how to send ASP.NET Identity emails using Twilio SendGrid.

    Prerequisites

    You will need these things to follow along:

    You can find the source code for this tutorial on GitHub. Use it if you run into any issues, or submit an issue, if you run into problems.

    Configure your SendGrid account …

    Read More
  • By Yan Sun
    Build a Doctor Appointment Bot with Azure Bot Service, Language Understanding, and Twilio SMS Build a Doctor Appointment Bot with Azure Bot Service, Language Understanding, and Twilio SMS

    Telehealth services can improve access to healthcare for people living in remote areas. One common issue in remote areas is unreliable internet service. It’s a challenge for patients in remote areas to make appointments via web applications when internet service is poor or not available at all.

    SMS is a reliable and low-cost alternative to reach people living in remote areas. In this article, you will learn how to build a doctor appointment booking system which allows users to book via SMS.

    System Overview

    The architecture of the SMS booking system is illustrated below.

    A diagram to explain how the SMS booking system works. Users send text messages using their phones to a Twilio Phone Number, Twilio forwards the message to the webhook URL which is pointing to the Azure Bot, the Azure Bot forwards the message to the Language Understanding service for AI analysis. The Azure Bot responds to Twilio and Twilio forwards the response back to the users" phone.

    Twilio is the communication channel between Microsoft Azure Bot Service and the end user. The core of the system is an Azure Bot built on the Microsoft Bot Framework. When the bot receives a message, it asks Language Understanding (LUIS) to analyze the message. LUIS responds with the intent of the message, which the bot …

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