Skip to contentSkip to navigationSkip to topbar

Twilio SendGrid

Build transactional and marketing email solutions with Twilio SendGrid.

Let's build

Take the next steps with Twilio SendGrid

Send your first email
Do more with email
Get started with Marketing Campaigns
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 Twilio SendGrid


Send your first email

Get started with the Twilio SendGrid Mail Send API and the open-source SDKs. To send your first message, use the following sample code in your preferred programming language.

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

To implement the previous code sample in your preferred programming language, jump to a quickstart for a full guide.


Do more with email

Twilio SendGrid offers tools that build your email communications program. Gather data from and report on the effectiveness of your email campaigns. Add content and accept files through inbound email. Use Twilio SendGrid to send and receive email or integrate with a cloud partner for email processing.

Beyond sending your first email

Get started with Marketing Campaigns

Create well-designed, personalized messages for your Marketing Campaigns.


Build your customer engagement infrastructure that fits the unique requirements of your business with the other communication channels from Twilio.

Messaging
Messaging

Send and receive Short Message Service (SMS), Multimedia Messaging Service (MMS), Rich Communication Services (RCS), or WhatsApp messages with Twilio Programmable Messaging.

Product documentation
Voice
Voice

Send and receive voice calls through your app with Twilio Programmable Voice.

Product documentation
Flex
Flex

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

Product documentation