With the recent news that Dyn is being acquired by Oracle for its DNS management business, people have been looking for solutions that are completely focused on email. Our team has had an increase in the number questions about how to migrate from Dyn email delivery to SendGrid, so we decided to put together this guide.
If you’d like to take a look around before getting going, check out the SendGrid documentation. The Classroom is a great place to start learning about email before diving into the API reference and details.
We have been an API-first, email only company since our inception, and you’ll find that reflected in our products. Our HTTP email endpoint, webhooks, SMTP, and non-email API are core to our business, and you’ll see that reflected in their capabilities. This guide will aim to give you the basics of how to get set up on SendGrid while highlighting useful features your current provider lacks.
Getting an API Key
First you’ll need a SendGrid account. Next, you should create an API key that you’ll use for sending. Go to Settings -> API keys, or use this link. A SendGrid and security best practice is to use a different API key for each of your different apps. API keys have granular permissions, so you can enable or disable read or write access for individual endpoints. Make sure the API key you create has full access to Mail Send. (Note: Your account must pass provisioning before you can create an API key.)
While Dyn provides official SDKs in Python and PHP, we seven officially supported API Libraries to make integration easier for our customers. If you’re rewriting any code, or refactoring how you communicate with your ESP as part of your migration, now is a good time to evaluate these libraries:
- sendgrid-csharp – Official C# library
- sendgrid-go – Official Go library
- sendgrid-java – Official Java library
- sendgrid-nodejs – Official NodeJS library
- sendgrid-php – Official PHP library
- sendgrid-python – Official Python library
- sendgrid-ruby – Official Ruby library
If you’re sending via SMTP, there are a few differences you should be aware of. First, you don’t need to worry about using a specific SMTP server based on your message size like Dyn requires. We also accept messages up to ~19.5MB versus Dyn’s limit of 10MB. To authenticate, provide the string ‘apikey’ as the SMTP username, and use your API key as the password. Then point your hostname to smtp.sendgrid.net.
We also offer additional port options compared to Dyn. You can connect using SMTP via unencrypted or TLS on ports 25, 2525, and 587. You can also connect via SSL on port 465. In general, we recommend port 587 as it tends to result in the fewest issues with hosting providers.
The mechanism for customizing email sent via SMTP is our X-SMTPAPI header. This header will allow you to define key/value substitutions, send batched mail-merge style requests, and control filters (like click tracking) that are active for your send. You can group emails by category, or track metadata per email with unique_args. These are powerful features that can reduce your sending time and the amount of bandwidth needed for your email transactions, and are worth exploring.
The main endpoint for sending email is the mail/send endpoint. Requests to this endpoint are authenticated via an authorization header with your API key presented as a bearer token. You can find a more detailed example in our docs.
Compared to Dyn’s HTTP API, our endpoint provides more features to enable you to customize and manage your recipients, and even send several different messages in a single request.
Personalizations allow you to define recipients and metadata for each message, such as substitution values for customizing content or custom_args for associating messages with user IDs or order numbers. There are a number of examples of personalizations for common use cases. You can also find cURL example calls.
Features like click tracking are configured via the tracking_settings and mail_settings parameters. You can also schedule sends up to 72 hours in advance by using the “send_at” parameter.
We also make it super easy to add attachments to your API request. Just encode your file as a Base64 string and embed it directly in the JSON payload alongside MIME content information. You can read more about including attachments in the following section of our Documentation Classroom.
SendGrid provides two webhooks: the Event Webhook for posting real-time emails events such as unsubscribes, bounces, etc, and the Inbound Parse Webhook for receiving emails and programmatically responding to them.
These features are not available on Dyn, but can be great for adding additional automation to your email management. They’re worth a look as you start setting up.
Non-email API Endpoints
For API endpoints that don’t send email, check out the API v3 overview. We use intuitive HTTP methods and response codes in most cases, and enforce rate limits for calls. API v2 is deprecated, though there is no timeline to stop supporting it. All new integrations should prefer v3. API v3 authentication is accomplished by an authentication header with a Bearer token.
Another feature that we offer is a robust Marketing Campaigns platform, letting you manage your lists, create dynamic segments, upload your assets, and design your email template with a visual editor, perform automatic A/B testing, and more. And of course there’s an open API behind all of these features as well.
A Few FAQs
Q: Do you support templates for transactional emails?
A: Yes, although our transactional templates do not support enumerations or conditionals at this time. (Stay tuned!)
Q: Is there a sandbox or a way to test my emails without sending them?
Q: Is it possible to transfer my IP address/sender reputation to SendGrid?
A: We can’t migrate an IP or reputation but we can help warm up a new IP for you automatically.
Q: Does SendGrid support enforced TLS?
A: Absolutely. You can require that receiving servers support TLS and drop messages going to servers that don’t comply.
Q: Can I allow my recipients to define the types of emails they want to receive?
A: Yes. Giving your recipients more control of their email lets you send email people want, which is better for everyone. Check out unsubscribe groups for more information.
If you’re interested in migrating to SendGrid, you can find more information at sendgrid.com/pricing.