Third-Party API Integrations

Email Services Compared — SendGrid, AWS SES, Mailgun, Postmark, Resend

By Domain India Team · DomainIndia EngineeringPublished 10 min read
Knowledge base article
Contents (14 sections)

Password resets, receipts and OTPs have to reach the inbox every time. This guide explains when your hosting account's own mail is enough and how to choose between the five best-known email APIs when it isn't.

Key takeaways

Sending a few messages from your Domain India-hosted site with PHP mail() is fine for a contact form. Anything transactional (receipts, OTPs, password resets) or at any real volume needs a dedicated email API: better deliverability, dashboards and suppression lists. Shared hosting is not for bulk or marketing mail. This guide compares the five major APIs on how they work, what they are best at and what to check before you sign up.

Why not just send from your hosting account?

Options:

  1. PHP mail() from shared hosting — works for contact forms and low-volume notices, with the -f envelope sender. No dashboards or bounce tracking.
  2. SMTP from your code on shared hosting — does not work on Domain India shared hosting. Our cPanel servers disable the socket functions SMTP libraries need, and on DirectAdmin the server's security layer blocks outgoing SMTP ports 25, 465 and 587 from websites.
  3. Direct SMTP through a personal Gmail account — sending limits, no dashboards, and Google may block the account.
  4. Email API (SendGrid, SES, etc.) — purpose-built for transactional mail, with the best deliverability and reporting.
Shared hosting limits and bulk mail

Mail sent by the hosting server is limited per account: 200 messages per hour on our cPanel servers and 1,000 per day per account (200 per mailbox by default) on DirectAdmin. Shared hosting is not for bulk mail, newsletters or marketing campaigns. Send newsletters and any volume through an email API or a newsletter service. Mail sent through an API leaves from the provider's servers and does not count against these limits.

For the short version of the shared-hosting routes, see Transactional email: SMTP, SendGrid and SES and Sending email from PHP.

The five major options

ServiceBest forNotes
SendGrid (Twilio)General-purpose transactional and marketingLong-established; templates and detailed dashboards
AWS SESCost-sensitive senders, AWS usersUsually the lowest cost at volume; new accounts start in a sandbox and must request production access; Mumbai region (ap-south-1) available
MailgunDevelopers, complex routingStrong routing rules and log search
PostmarkTransactional mail firstKeeps transactional and broadcast mail on separate message streams; known for fast delivery
ResendModern developer experienceSimple API and React email templates

Free tiers and prices change often, so check each provider's pricing page on the day you sign up, and compare them at your real monthly volume.

Decision tree

"Just want it to work":

  • Small volume: Resend or Postmark (simple setup)
  • Medium: SendGrid or Mailgun
  • High volume: AWS SES (usually cheapest per email)

"Transactional mail must arrive fast, every time":

  • Postmark — transactional-first, with broadcast mail kept on a separate stream

"Already use AWS / cost-sensitive":

  • AWS SES

"Want React/HTML templates in code":

  • Resend — works with react-email

"Need SMS + email + WhatsApp from one vendor":

  • SendGrid (owned by Twilio)

Deliverability — the real differentiator

Every reputable provider can reach the inbox. What decides where your mail lands is mostly under your control:

  • Authentication: SPF, DKIM and DMARC for your domain, with the From domain aligned. Without them, Gmail and others send mail to spam or reject it.
  • Reputation: your domain's history and the provider IP's history, built from bounces and spam complaints.
  • List hygiene: stop sending to addresses that bounce or complain.
  • Separation: keep marketing mail on a different subdomain, stream or provider from password resets and receipts.

Since 2024, Gmail and Yahoo require bulk senders to have SPF, DKIM and DMARC, keep the spam complaint rate below 0.3%, and offer one-click unsubscribe on marketing mail. To check your own setup, see How to test email deliverability for your own website.

Setup — all five are similar

Pattern:

  1. Sign up and verify domain ownership
  2. Add the SPF and DKIM DNS records they provide (a domain can have only one SPF record, so add each provider to it)
  3. Get an API key
  4. Send with an HTTPS request
  5. Configure webhooks for delivery events and bounces

On our cPanel servers, PHP's curl_exec() works, so provider SDKs that call the API over HTTPS connect normally. On our DirectAdmin servers curl_exec is usually disabled for websites, so test your library first. Composer isn't pre-installed on shared hosting: run php composer.phar require over jailed SSH (on request), or install SDKs on your own computer and upload the project with its vendor/ folder. See PHP disabled functions on shared hosting.

Example — Resend (simplest)

bash
npm install resend
typescript
import { Resend } from 'resend';

const resend = new Resend(process.env.RESEND_API_KEY);

await resend.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome!',
  html: '<p>Thanks for signing up</p>',
});

Example — SendGrid

bash
npm install @sendgrid/mail
typescript
import sgMail from '@sendgrid/mail';

sgMail.setApiKey(process.env.SENDGRID_API_KEY);

await sgMail.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome!',
  html: '<p>Thanks for signing up</p>',
});

Example — AWS SES

bash
npm install @aws-sdk/client-sesv2
typescript
import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-sesv2';

const ses = new SESv2Client({ region: 'ap-south-1' });

await ses.send(new SendEmailCommand({
  FromEmailAddress: '[email protected]',
  Destination: { ToAddresses: ['[email protected]'] },
  Content: {
    Simple: {
      Subject: { Data: 'Welcome!' },
      Body: { Html: { Data: '<p>Thanks!</p>' } },
    },
  },
}));

Template management

Three approaches:

1. In-code templates (Resend + react-email):

tsx
import { Html, Head, Body, Heading } from '@react-email/components';

export function WelcomeEmail({ name }) {
  return (
    <Html>
      <Head />
      <Body>
        <Heading>Welcome {name}!</Heading>
      </Body>
    </Html>
  );
}

await resend.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome!',
  react: <WelcomeEmail name="Rajesh" />,
});

Component-driven, previewable, testable.

2. Provider-hosted templates (SendGrid, Mailgun):

Create the template in the dashboard and reference it by ID:

typescript
await sgMail.send({
  from: '[email protected]',
  to: '[email protected]',
  templateId: 'd-abc123...',
  dynamicTemplateData: { name: 'Rajesh', orderId: 'ORD-1234' },
});

The marketing team can edit templates without a deploy.

3. MJML + a template engine (self-hosted):

MJML compiles to responsive HTML. Keep templates in git and render them at send time. See mjml.io.

Webhooks — track what happens

Providers send webhook events such as:

  • delivered — the receiving server accepted it
  • opened — the user opened it (needs a tracking pixel; unreliable with Apple Mail privacy)
  • clicked — the user clicked a link
  • bounced — undeliverable (hard vs soft)
  • complained — the user marked it as spam
  • unsubscribed — the user opted out

Event names differ by provider. A SendGrid-style handler:

typescript
app.post('/webhook/email', express.raw({ type: 'application/json' }),
  async (req, res) => {
    // Verify the provider's signature before trusting the body
    const events = JSON.parse(req.body);
    for (const e of events) {
      if (e.event === 'bounce') {
        await db.suppressionList.create({ data: { email: e.email, reason: 'bounce' } });
      }
      if (e.event === 'spamreport') {
        await db.user.update({ where: { email: e.email }, data: { suppressed: true } });
      }
    }
    res.sendStatus(200);
  }
);

Critical: never send to suppressed addresses. A high bounce or complaint rate damages your domain's reputation quickly.

India-specific notes

  • Mobile numbers and email — many Indian apps verify both phone and email; plan for both.
  • Hindi and regional languages — all providers support UTF-8. Test how your templates render Devanagari and other Indic scripts in Gmail and Outlook, and pick fonts with fallbacks.
  • GST on foreign bills — most providers bill from outside India. A GST-registered business may need to pay GST on imported services under reverse charge; ask your accountant.
  • Card payments — recurring charges to foreign services on Indian cards can hit e-mandate and 3-D Secure checks; make sure your card is enabled for international recurring payments.

Dedicated IP — when to consider one

Providers offer dedicated IPs as a paid add-on. Consider one when:

  • You send high, steady volume every day
  • You want your reputation separate from other senders on a shared pool
  • You run large scheduled sends

A dedicated IP needs warming up: increase volume gradually over weeks. At low volume, a well-run shared pool usually delivers better than a cold dedicated IP.

Common pitfalls

Not verifying your domain
Mail shows "via sendgrid.net" or similar, which hurts trust. Verify the domain and add SPF and DKIM.
Sending from a gmail.com address
Gmail's DMARC policy makes receivers reject it. Send from your own domain.
Ignoring bounce feedback
Reputation drops fast. Suppress hard bounces and complaints.
No unsubscribe link on marketing mail
Gmail and Yahoo require one-click unsubscribe for bulk senders, and laws such as CAN-SPAM require an opt-out.
Two SPF records
A domain may have only one SPF record. Merge every provider into it.
Bulk mail from shared hosting
The per-account limits stop it. Use an API or newsletter service.

FAQ

Can I use Domain India hosting to send transactional or bulk email?

For a contact form or a few notices, PHP mail() with the -f envelope sender works. Mail sent by the hosting server is limited to 200 messages per hour per account on cPanel and 1,000 per day (200 per mailbox by default) on DirectAdmin, and shared hosting is not for bulk or marketing mail. For password resets, receipts, OTPs and newsletters, use an email API or newsletter service.

Can I use SMTP from PHP on Domain India shared hosting?

No. Our cPanel servers disable the PHP socket functions that SMTP libraries use, and our DirectAdmin servers block outgoing SMTP ports 25, 465 and 587 from websites. Use PHP mail() with the -f envelope sender, or a provider's API over HTTPS.

Which service is best for OTPs?

Any of the five can deliver OTPs quickly once your domain is authenticated. Postmark is built around transactional speed; SES, SendGrid and Resend are also widely used. For critical one-time codes, many Indian apps send by SMS as well as email.

Can I use two services for redundancy?

Yes. Send through a primary provider and fall back to a second one if its API returns errors. Authenticate your domain with both, and add both to your single SPF record.

Do I need a separate sender for marketing and transactional mail?

Yes. Use an address such as noreply@ or alerts@ on your main domain for transactional mail, and a subdomain such as news.yourdomain.com, or a separate provider, for marketing. A complaint about a newsletter then can't hurt your password resets.

Ready to send? Set up the PHP route with Sending email from PHP, or run your app on the App Platform or a VPS and send through the API of your choice. Host the website itself on cPanel hosting.

Host your app, send through an API

Host your website with Domain India and send transactional email reliably through the provider of your choice.

View cPanel hosting

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app