Skip to content

Add email support to your Cordova/Ionic/Web projects.

License

Notifications You must be signed in to change notification settings

TeamMaestro/capacitor-email

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capacitor Email

Usage

import { Email } from '@teamhive/capacitor-email';

const email = new Email();

const hasPermission = await email.hasPermission();

if(!hasPermission){
    await email.requestPermission();
}

const available = await email.isAvailable({
      alias: 'gmail' // gmail, outlook, yahoo *optional*,
});

// available.hasAccount  *If email is setup*
// available.hasApp  *If device has alias supplied*


if(available.hasAccount){
    email.open({
    to:['[email protected]'],
    cc: ['[email protected]'],
    bcc: ['[email protected]'],
    subject: 'Party',
    body: 'Hi bring drinks...',
    isHtml: false,
    attachments: [SomeFilePath]
    })
}

Api

Method Default Type Description
isAvailable(options?: AvailableOptions) Promise<AvailableResults>
open(options?: EmailOptions) Promise<any>
openDraft() Promise<any>
requestPermission() Promise<any>
hasPermission() Promise<any>
getDefaults() Promise<any>
getAliases() Promise<any>