Skip to contentSkip to navigationSkip to topbar

SendGrid

Find the documentation, sample code, and developer tools you need to build your transactional and marketing email solutions on the platform that offers a 99% deliverability rate.

Let's build

Take the next steps with SendGrid

Send your first email
1
Twilio servers
2
Your app
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: 'recipient@example.com',
from: 'sender@example.com',
subject: 'Ahoy!',
html: 'Ahoy, World!',
};
sgMail
.send(msg)
.then((error) => console.error(error));
View complete examples(link takes you to an external page)
3
Ahoy, world!

Take the next steps with SendGrid


Send your first email

Get started quickly with the Twilio SendGrid Mail Send API and our open-source helper libraries. The sample code below will send your first message in no time.

C#GoJavaNode.jsPHPPythonRuby
1
using System;
2
using System.Threading.Tasks;
3
using SendGrid;
4
using SendGrid.Helpers.Mail;
5
6
class Program
7
{
8
static async Task Main()
9
{
10
var apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");
11
var client = new SendGridClient(apiKey);
12
var from = new EmailAddress("test@example.com", "Example User");
13
var subject = "Sending with Twilio SendGrid is Fun";
14
var to = new EmailAddress("test@example.com", "Example User");
15
var plainTextContent = "and easy to do anywhere, even with C#";
16
var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";
17
var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
18
var response = await client.SendEmailAsync(msg).ConfigureAwait(false);
19
}
20
}
Email API quickstarts

Jump to an email quickstart in your programming language of choice for a full guide on how to implement the code samples above.


Do more with email

Sending email is just the start. With SendGrid, you get rich data that allows you to establish and maintain a complete email program. You can also parse inbound messages to create rich email-based experiences for your customers.

Looking to leverage SendGrid's reliability and scale for your SMTP needs or integrate with a cloud partner such as Azure? You can do that too.

Beyond sending your first email

Get started with Marketing Campaigns

Create beautifully designed messages, personalized to each recipient, with best in class deliverability when you send with Marketing Campaigns.


Explore Twilio's other communication channels to build customer engagement infrastructure that fits the unique requirements of your business.

Messaging
Messaging

Send and receive SMS/MMS and/or WhatsApp messages with the Twilio's Programmable Messaging API.

Product documentation
Voice
Voice

Quickly make and receive voice calls in your application with Twilio Voice.

Product documentation
Flex
Flex

Build your digital engagement center for sales and customer support teams with Twilio Flex.

Product documentation

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.