Hi, I am going to teach about how to send an email with ionic framework using the native email application in ionic 3 and Angular 4.
First, we want to install ionic Cordova plugin in CLI.
$ ionic cordova plugin add cordova-plugin-email-composer
$ npm install --save @ionic-native/email-composer
Home.html
<ion-header>
<ion-navbar>
<ion-title>
EMAIL
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding fullscreen="true">
<div text-center style="margin-top: 5cm">
<button ion-button (tap)="send()">Send-Email</button>
</div>
</ion-content>
app.module.ts
import { EmailComposer } from '@ionic-native/email-composer' ;
providers: [
.....
EmailComposer,
.....
]
Home.ts
import { Component } from '@angular/core';
import {NavController, ToastController} from 'ionic-angular';
import { EmailComposer } from '@ionic-native/email-composer' ;
@Component({
selector: 'page-home',
templateUrl: 'home.html' })
export class HomePage {
constructor(private emailComposer: EmailComposer) {
}
send(){
this.emailComposer.isAvailable ().then((available: boolean) =>{
if(available) {
//Now we know we can send }
});
let email = {
to: 'example@gmail.com',
subject: 'Cordova Icons',
body: 'How are you? Nice greetings from Leipzig',
isHtml: true };
How to send an email with ionic framework using the native email application?(android and ios)
Reviewed by Sudhan
on
October 10, 2017
Rating:
Run time error. Its says cordova_not_available
ReplyDeleteFirst you want to add plugin
Deletehttps://ionicframework.com/docs/native/email-composer/
not working! cordova_not_available. was installed but not working, please help me?
ReplyDeletedid you find a solution?? i have the same problem
DeleteHey thanks for the Solution , as this is by cordova plugin you need to run it on device , it will not be working in browser
ReplyDeletehi, thnks for the tutorial. im kind of new on ionic and i dont understend where i link the "email" sentence on "let email = {" with the form. sorry if my question is to obvious
ReplyDeleteCannot read property 'split' of undefined this error comming
ReplyDelete