Send email
Send an email from your Ionic App using one of the mail applications installed in their phone.
This functionality allows users to send an email using one of the mail applications installed in their phone. Using Email Composer plugin this functionality can be implemented successfully.
To install run:
1
$ ionic plugin add --save cordova-plugin-email
2
3
$ npm install --save @ionic-native/email-composer
Copied!
Usage examples:
1
this.emailComposer.isAvailable().then((available: boolean) =>{
2
if(available) {
3
//Now we know we can send
4
}
5
});
6
7
let email = {
11
attachments: [
12
'file://img/logo.png',
13
'res://icon.png',
14
'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
15
'file://README.pdf'
16
],
17
subject: 'Cordova Icons',
18
body: 'How are you? Nice greetings from Leipzig',
19
isHtml: true
20
};
21
22
// Send a text message using default options
23
this.emailComposer.open(email);
Copied!
1
sendMail(){
2
//for more option please go here: http://ionicframework.com/docs/native/email-composer/
3
let email = {
5
subject: 'This app is the best!',
6
body: "Hello, I'm trying this fantastic app that will save me hours of development"
7
};
8
// Send a text message using default options
9
this.emailComposer.open(email);
10
}
Copied!
For more information visit the plugin documentation: https://ionicframework.com/docs/native/email-composer/
Last modified 3yr ago
Copy link