Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
capacitor-email-composer
Advanced tools
This Plugin is used to open a native E-Mail Composer within your Capacitor App.
This and other Open-Source Cordova/Capacitor Plugins are developed in my free time. To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes.
Table of Content
npm install capacitor-email-composer
npx cap sync
You can add attachments to the draft mail by using the attachments
option in the open(...)
method.
Every attachment needs a type
and a path
. If you are adding a base64
type attachment, you also need to set the name
:
The path to the files must be defined absolute from the root of the file system. On Android the user has to allow the app first to read from external storage!
EmailComposerPlugin.open({
attachments: [{
type: 'absolute',
path: 'storage/sdcard/icon.png' // Android
}]
})
Each app has a resource folder, e.g. the res folder for Android apps or the Resource folder for iOS apps. The following example shows how to attach the app icon from within the app's resource folder.
EmailComposerPlugin.open({
attachments: [{
type: 'resource',
path: 'icon.png'
}]
})
The path to the files must be defined relative from the root of the mobile web app assets folder, which is located under the build folder.
EmailComposerPlugin.open({
attachments: [{
type: 'asset',
path: '/icon/favicon.png' // starting slash is important
}]
})
The code below shows how to attach a base64 encoded image which will be added as an image. You must set a name.
EmailComposerPlugin.open({
attachments: [{
type: 'base64',
path: 'iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6...',
name: 'icon.png' // this is required
}]
})
hasAccount() => Promise<{ hasAccount: boolean; }>
Checks if the User can send a Mail iOS: Check if the current Device is configured to send mail Android: Currently does nothing
Returns: Promise<{ hasAccount: boolean; }>
open(options?: OpenOptions | undefined) => Promise<void>
Open the E-Mail Composer
Param | Type | Description |
---|---|---|
options | OpenOptions | optional Options to prefill the E-Mail |
Prop | Type | Description |
---|---|---|
to | string[] | email addresses for TO field |
cc | string[] | email addresses for CC field |
bcc | string[] | email addresses for BCC field |
subject | string | subject of the email |
body | string | email body |
isHtml | boolean | indicates if the body is HTML or plain text (primarily iOS) |
attachments | Attachment[] | attachments that are added to the mail file paths or base64 data streams |
Prop | Type | Description |
---|---|---|
path | string | The path of the attachment. See the docs for explained informations. |
type | 'absolute' | 'resource' | 'asset' | 'base64' | The type of the attachment. See the docs for explained informations. |
name | string | The name of the attachment. See the docs for explained informations. Required for base64 attachements. |
The full Changelog is available here
FAQs
E-Mail Composer Plugin for Capacitor
The npm package capacitor-email-composer receives a total of 1,873 weekly downloads. As such, capacitor-email-composer popularity was classified as popular.
We found that capacitor-email-composer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.