Jump to an email quickstart in your programming language of choice for a full guide on how to implement the code samples above.
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.
Take the next steps with SendGrid
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));
Take the next steps with SendGrid
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.
1using System;2using System.Threading.Tasks;3using SendGrid;4using SendGrid.Helpers.Mail;56class Program7{8static async Task Main()9{10var apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");11var client = new SendGridClient(apiKey);12var from = new EmailAddress("test@example.com", "Example User");13var subject = "Sending with Twilio SendGrid is Fun";14var to = new EmailAddress("test@example.com", "Example User");15var plainTextContent = "and easy to do anywhere, even with C#";16var htmlContent = "<strong>and easy to do anywhere, even with C#</strong>";17var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);18var response = await client.SendEmailAsync(msg).ConfigureAwait(false);19}20}
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.
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.
Send and receive SMS/MMS and/or WhatsApp messages with the Twilio's Programmable Messaging API.
Product documentationQuickly make and receive voice calls in your application with Twilio Voice.
Product documentationBuild your digital engagement center for sales and customer support teams with Twilio Flex.
Product documentation