Migrating from SendGrid

From SendGrid to Hermaily, changing only the URL

Hermaily accepts SendGrid v3 API requests on the same path. Keep @sendgrid/mail, sendgrid-php or sendgrid-python: you only change the base URL and the key.

  • Paths /v3/mail/send
  • SMTP smtp.hermaily.com:587
  • Webhooks in SendGrid format

Who it is for and what you gain

  • You use SendGrid for transactional email (signups, passwords, orders) or for broadcasts to consent-based lists, and you want to keep your code.
  • You want your data and your sending in the European Union, under a GDPR data processing agreement.
  • You pay for volume you do not use: SendGrid's smallest plan is 50,000 emails and, according to its pricing page, there is no longer a free plan (only a 60-day trial). Hermaily has plans from 3,000 emails and a free one with 300 a month.

Steps

  1. Create your account and verify your domain. In the dashboard, under Domains, the assistant gives you the DKIM, SPF (MAIL FROM) and DMARC records and checks they are published. They can live alongside SendGrid's: they do not clash. New accounts are reviewed before they can send.
  2. Create an API key for that domain (one per application: if one is compromised, you revoke only that one).
  3. Create the webhook in SendGrid format, under Webhooks, with your current receiver's URL. The Test button sends you a sample event.
  4. Change the base URL (or the SMTP host) and the key in your application. That is all: the rest of the code stays as it is.
  5. Send a test and look at it in the dashboard, with its delivery. When everything is fine, retire your SendGrid key.

Code before and after

With SendGrid's official library for each language. The highlighted lines are the ones that change.

Node.js · @sendgrid/mail

Node.js · before
const sgMail = require("@sendgrid/mail");
sgMail.setApiKey(process.env.SENDGRID_API_KEY);

await sgMail.send({
  to: "lucia@example.com",
  from: "hello@acme.example",
  subject: "Your order is on its way",
  html: "<p>Hi Lucía, your order has shipped.</p>",
});
Node.js · after
const client = require("@sendgrid/client");const sgMail = require("@sendgrid/mail");
client.setApiKey(process.env.HERMAILY_API_KEY);client.setDefaultRequest("baseUrl", "https://api.hermaily.com/");sgMail.setClient(client);
await sgMail.send({
  to: "lucia@example.com",
  from: "hello@acme.example",
  subject: "Your order is on its way",
  html: "<p>Hi Lucía, your order has shipped.</p>",
});

PHP · sendgrid/sendgrid

PHP · before
$sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY'));

$email = new \SendGrid\Mail\Mail();
$email->setFrom('hello@acme.example', 'Acme');
$email->addTo('lucia@example.com');
$email->setSubject('Your order is on its way');
$email->addContent('text/html', '<p>Hi Lucía, your order has shipped.</p>');
$sendgrid->send($email);
PHP · after
$sendgrid = new \SendGrid(getenv('HERMAILY_API_KEY'), ['host' => 'https://api.hermaily.com']);
$email = new \SendGrid\Mail\Mail();
$email->setFrom('hello@acme.example', 'Acme');
$email->addTo('lucia@example.com');
$email->setSubject('Your order is on its way');
$email->addContent('text/html', '<p>Hi Lucía, your order has shipped.</p>');
$sendgrid->send($email);

Python · sendgrid

Python · before
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

sg = SendGridAPIClient(os.environ["SENDGRID_API_KEY"])
sg.send(Mail(
    from_email="hello@acme.example",
    to_emails="lucia@example.com",
    subject="Your order is on its way",
    html_content="<p>Hi Lucía, your order has shipped.</p>",
))
Python · after
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

sg = SendGridAPIClient(os.environ["HERMAILY_API_KEY"], host="https://api.hermaily.com")sg.send(Mail(
    from_email="hello@acme.example",
    to_emails="lucia@example.com",
    subject="Your order is on its way",
    html_content="<p>Hi Lucía, your order has shipped.</p>",
))

Over SMTP

If you send over SMTP (a CMS, an ERP, an application that does not speak HTTP), the change is even shorter:

SendGridHermaily
Hostsmtp.sendgrid.netsmtp.hermaily.com
PortWhichever you use587 (STARTTLS) or 465 (TLS)
Usernameapikeyapikey (any value works)
PasswordYour SendGrid keyYour Hermaily API key

For the broadcast stream, add the header X-Hermaily-Stream: broadcast. More details in the SMTP documentation.

Equivalents

POST /v3/mail/send

The base URL goes from https://api.sendgrid.com to https://api.hermaily.com. Unrecognized fields are ignored without an error, so also check what is not supported.

SendGridIn Hermaily
Authorization: BearerYour Hermaily API key.
personalizationsEach one (1 to 1000) is a separate message, with its to, cc, bcc, subject, headers, and substitutions applied to the subject and bodies.
from, reply_to, reply_to_listSame.
contenttext/plain and text/html.
attachmentsSame; disposition: inline with content_id to embed.
categoriesAll of them become tags of the message (up to 10, like SendGrid).
custom_argsMetadata (a personalization's values override the global ones); in webhooks they arrive at the root of the event, as in SendGrid.
tracking_settingsopen_tracking.enable and click_tracking.enable.
asmWhen present, the message goes through the broadcast stream. Also with the header X-Hermaily-Stream: broadcast.
Response202 with no body, and the id of the last message created in X-Message-Id.

Webhook events

With the webhook in SendGrid format, each Hermaily event arrives with the name SendGrid uses:

HermailyWhat happenedSendGrid format
sendLeft for the recipient's serverprocessed
deliveryDelivereddelivered
delivery_delayTemporary delaydeferred
bounceBouncePermanent: bounce; temporary: deferred
complaintSpam complaintspamreport
rejectRejected before sendingdropped
rendering_failureRendering failuredropped
openOpenopen
clickClickclick
unsubscribeUnsubscribeunsubscribe

SendGrid's ECDSA Event Webhook signature is not imitated: if your receiver checks it, replace that check with X-Hermaily-Signature (HMAC-SHA256, how to verify it). The body is the same: a list of events with event, email, timestamp, sg_message_id and your custom_args.

The full reference, with every field, is in the documentation: migrating from SendGrid.

What is not supported

Hermaily emulates SendGrid's sending, not its whole API. This is what you will not find:

  • Dynamic templates (template_id, dynamic_template_data): ignored. Send the finished HTML.
  • Scheduled sending (send_at, batch_id): ignored, and the message goes out right away.
  • mail_settings, sandbox_mode included: ignored, so a “test” send is really sent. To test, use your own addresses.
  • The rest of the v3 API (stats, suppressions, templates, Marketing Campaigns, contacts, Inbound Parse, subusers): it does not exist here. Suppressions, stats and lists are managed in the dashboard.
  • The ECDSA Event Webhook signature (see above).

What it costs compared with SendGrid

Monthly cost of both services at the most common volumes:

Monthly cost before tax: Hermaily and SendGrid
Emails a monthHermailyPlan HermailySendGrid
10,000$6 (€5)Starter$19.95
50,000$19.50 (€17)Growth$19.95
100,000$33.50 (€29)Business$34.95
250,000$79 (€69)Pro$249

Prices before tax. Hermaily: the cheapest plan that covers the volume, counting overage, with messages of up to 50 kB on average. SendGrid: prices checked on 26 November 2026 on its pricing page, cheapest monthly plan with no annual commitment that covers the volume. More providers and volumes in Pricing.

Not sure yet whether to switch? See Hermaily as a SendGrid alternative: why people switch and when SendGrid is still the better choice.

Frequently asked questions

Do I have to change my code to migrate from SendGrid?

No. Keep SendGrid's official library and change only the base URL (or the SMTP host) and the API key. Request bodies and responses have SendGrid's shape.

Do my SendGrid webhooks keep working?

Yes, if you create the webhook in SendGrid format: the same list of events arrives. The only difference is the signature: instead of SendGrid's ECDSA one, Hermaily signs with X-Hermaily-Signature.

What about my SendGrid dynamic templates?

Hermaily has no templates in the API: template_id and dynamic_template_data are ignored. Build the HTML in your application before sending it.

Can I use SMTP instead of the API?

Yes. Replace smtp.sendgrid.net with smtp.hermaily.com (port 587 with STARTTLS or 465 with TLS), with username apikey and your Hermaily key as the password, just like in SendGrid.

Can I migrate gradually?

Yes. Since the code is the same, you can send part of your traffic through Hermaily (one kind of email, one domain or a percentage) and the rest through SendGrid until you are confident.

Is it cheaper than SendGrid?

At the volumes in the table on this page, yes: SendGrid's smallest plan is 50,000 emails, and Hermaily has plans from 3,000. The table shows the date we checked their prices.

Try Hermaily with your SendGrid code

Create the account, verify your domain and send your first email with the library you already have. The Free plan includes 300 emails a month.

Create a free account