Email Integration into Mobile Application
Sending email from mobile app—a task with several complexity levels. You can open native mail client via mailto: and call it integration. You can send transactional emails via SMTP directly from device, which no one should do in production. Or do it right—via mail provider API from server, but with user-friendly interface in app.
Three Scenarios and Their Implementation
Scenario 1: Open Native Client. Simplest. iOS—MFMailComposeViewController from MessageUI.framework, Android—Intent.ACTION_SENDTO with Uri.parse("mailto:"). Suitable when user just needs to write email—to support, for example.
Caveat: MFMailComposeViewController unavailable on simulator and devices without configured mail. Always check MFMailComposeViewController.canSendMail() before showing, else crash.
Scenario 2: Transactional Emails via API. Registration, password reset, order notifications—emails sent from server, app only initiates request. Provider choice:
| Provider | SDK | Free tier |
|---|---|---|
| SendGrid | REST API + official SDK | 100 emails/day |
| Mailgun | REST API | 100 emails/day |
| Amazon SES | AWS SDK | 62k emails/month (within AWS) |
| Postmark | REST API | No free |
Mobile app requests its backend (POST /api/send-email), backend calls provider API. API keys never stored in app.
Scenario 3: Reading and Sending Email in App Interface. Full email client inside app—this is IMAP/SMTP or Graph API (Outlook) / Gmail API. For Gmail: OAuth 2.0 authorization, get message list via users.messages.list, bodies via users.messages.get. Gmail API quotas—250 units per request, 1 billion units/day per project limit. Active use requires monitoring.
Working with Attachments
Attachments in mobile context require care. On iOS, files from UIDocumentPickerViewController accessible via security-scoped bookmarks and require explicit startAccessingSecurityScopedResource() / stopAccessingSecurityScopedResource() calls. Without this you get NSCocoaErrorDomain code 257. On Android with API 30+, direct /sdcard access closed—only via MediaStore or ACTION_OPEN_DOCUMENT.
For downloading attachments—streaming with progress, URLSession.downloadTask on iOS or OkHttp with ResponseBody.byteStream() on Android. Don't buffer everything in memory if attachment could be large.
Push Notifications on New Mail
For real-time new mail notifications, IMAP IDLE keeps TCP connection—on mobile it kills battery. Right path: server listens IMAP IDLE, on new mail sends push via FCM/APNs. App receives push, makes request, updates list.
Estimate: simple transactional mail sending integration—2-3 days. Built-in mail client with IMAP/OAuth—3 to 6 weeks.







