как я могу сделать снимок с помощью ioini c 4 и отправить его по электронной почте? - PullRequest
0 голосов
/ 25 мая 2020
• 1000 описание, но он не получил токен с фотографией, это мой код, пожалуйста, мне нужна помощь
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { EmailComposer } from '@ionic-native/email-composer';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
 capturedSnapURL:string;
  image: null;

  cameraOptions: CameraOptions = {


    mediaType: this.camera.MediaType.PICTURE,
    saveToPhotoAlbum: true,
    //sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
    quality: 100,
   destinationType: this.camera.DestinationType.DATA_URL,
   encodingType: this.camera.EncodingType.JPEG

  }
  constructor(public navCtrl: NavController,private camera: Camera,private emailcomposer: EmailComposer ,
    private file: File, private domsanitizer: DomSanitizer, private webview: WebView , ) {}


  public getPicture() {  
    this.camera.getPicture(this.cameraOptions).then((imageData) => {
      //  this.camera.DestinationType.FILE_URI
       // this.camera.DestinationType.DATA_URL gives base64 URI

       let base64Image = 'data:image/jpeg;base64,' + imageData; 
       this.capturedSnapURL = base64Image;
       this.image = imageData;
    });
    }  

  Send(){
    let email = {
      to: 'gestiondeprojetetreclamation@gmail.com',
      cc: 'gaiedhazem@gmail.com',

      attachments: [
     this.image
      ],
      subject: 'Photo',
      body: 'Latest photo taked',
      isHtml: true
    }

    // Send a text message using default options
    this.emailcomposer.open(email);
  }

}
...