Email, SMS, and Push Notifications
Applications communicate with users through multiple channels: email, SMS, push notifications, in-app messages. Each has different purposes, delivery guarantees, and user expectations.
Transactional emails are triggered by user actions (welcome email, password reset, order confirmation). Marketing emails are bulk messages. This section focuses on transactional communication.
Transactional Email: The Foundation
Email is reliable, reaches any user with an email address, and is the expected way to deliver important information. Password resets, order confirmations, notifications—email is the standard.
Don't build your own email sending. SMTP directly has deliverability problems (spam filters, rate limits). Use an email service provider.
Email Service Providers
- Resend: Modern email API, great for developers, free tier for testing
- SendGrid: Industry standard, comprehensive features, good deliverability
- Postmark: Focused on transactional email, excellent deliverability
- AWS SES: Cheap, integrates with AWS ecosystem, requires IP warmup for good deliverability
- Mailgun: Developer-friendly, good APIs, logging
All are good. Choose based on: deliverability (they all have good rates), price, integration ease, and support.
Email Templates and Design
HTML email is notoriously inconsistent across clients. Gmail renders it one way, Outlook another, Apple Mail another. Some don't support CSS well. Some strip images.
Don't write email templates from scratch. Use tools designed for email: MJML, Email on Acid, Stripo. They handle cross-client compatibility.
Test emails across clients (Gmail, Outlook, Apple Mail, mobile). What looks good in your email client might look terrible elsewhere.
Deliverability: SPF, DKIM, DMARC
Email gets spam-filtered easily. Good deliverability requires:
- SPF (Sender Policy Framework): DNS record saying "these mail servers are authorized to send email from my domain"
- DKIM (DomainKeys Identified Mail): Cryptographic signature proving emails came from you
- DMARC (Domain-based Message Authentication): Policy for what to do with emails that fail SPF/DKIM
Set these up from the beginning. Without them, emails go to spam folders.
SMS: Immediate but Limited
SMS reaches people immediately and is read quickly (higher open rates than email). But it's expensive, character-limited, and impersonal.
Use SMS for: OTP codes (one-time passwords), urgent alerts, time-sensitive information. Don't use for marketing (regulatory requirements).
Providers: Twilio (industry standard), AWS SNS (integrated with AWS), Vonage, Telnyx.
Push Notifications: App-Only
Push notifications work for mobile apps and web (if you register the user's browser). They're immediate and can bring users back to your app.
FCM (Firebase Cloud Messaging) for Android, APNs (Apple Push Notification service) for iOS. For web, use service workers and Web Push API.
Challenges: most users have notification permissions disabled, implementation is complex, requires native app or service worker setup.
In-App Notifications: Simple and Effective
Show notifications directly in your application (notification bell, toast messages, banners). This is simple to implement and effective.
Store notifications in the database: user_id, message, read/unread, timestamp. Users see them when they visit your app.
No external dependencies, no delivery concerns, 100% reliable. Great for non-urgent notifications.
Notification Preferences: Required for Legal and UX
Users must be able to opt out of notifications (except critical ones like password reset). This is:
- Legal requirement in many jurisdictions (CAN-SPAM in the US, GDPR in Europe)
- UX requirement (users hate spam)
- Ethical (respect user preferences)
Store preferences per user: email notifications enabled/disabled, SMS notifications enabled/disabled, notification types (marketing, transactional, etc.).
Communication Channel Comparison
| Channel | Best For | Delivery Guarantee | Setup Complexity |
|---|---|---|---|
| Important, non-urgent, permanent record | High (95%+) with SPF/DKIM | Moderate | |
| SMS | OTP, urgent alerts | High, immediate | Moderate |
| Push notifications | Re-engagement, immediate updates | Medium (depends on user) | High |
| In-app notifications | General notifications, low urgency | 100%, always delivered | Low |
Transactional vs Marketing Email
Don't mix transactional and marketing. Transactional emails are triggered by user action and critical (password reset, order confirmation). Marketing emails are bulk, promotional, and optional.
Infrastructure differs: transactional needs high deliverability, immediate sending. Marketing can batch and optimize for cost.
Use different email addresses or subdomains for each. This prevents marketing failures from breaking transactional emails.
The Principle
Communication is how users experience your application. Good notification practices keep users informed. Poor practices annoy them. Choose the right channel for the message, respect user preferences, and deliver reliably.