@napacitor/email
Email plugin wrapping the .NET MAUI Email API: compose and send emails.
Installation
To use npm:
npm install @napacitor/email
To use yarn:
yarn add @napacitor/email
Sync native files:
npx nap sync
Usage
import { Email } from '@napacitor/email';
// Check for support
const { supported } = await Email.isSupported();
if (supported) {
await Email.compose({
to: ['user@example.com'],
cc: ['admin@example.com'],
subject: 'Hello',
body: 'This is a test email.',
isHtml: false,
});
}
How It Works
Wraps the .NET MAUI Email.Default.IsComposeSupported / ComposeAsync facade, opening the system mail client. compose() throws UNSUPPORTED when the device does not support it. Note: the plugin only invokes the system mail client and does not provide background silent sending; the attachments parameter is not mapped on the native side yet (MAUI EmailMessage supports attachments, but this plugin has not wired them up).
Permissions
Android
No additional configuration required.
iOS
No additional configuration required.
Windows
No additional configuration required.
API
isSupported()
Checks whether sending email is supported.
Returns: Promise<EmailSupportedResult>
compose(options?)
Composes and sends an email (opens the system mail client); throws UNSUPPORTED when the device does not support it.
| Param | Type |
|---|---|
options | ComposeOptions |
Returns: Promise<void>
Interfaces
ComposeOptions
| Prop | Type | Description |
|---|---|---|
to | string[] | Recipient list. |
cc | string[] | CC list. |
bcc | string[] | BCC list. |
subject | string | Email subject. |
body | string | Email body. |
isHtml | boolean | Whether the body is HTML. |
attachments | string[] | Attachment list (file paths). Not mapped on the native side yet (MAUI EmailMessage supports attachments, but this plugin has not wired them up). |
EmailSupportedResult
| Prop | Type | Description |
|---|---|---|
supported | boolean | Whether the device supports sending email. |