katzer / cordova-plugin-email-composer

Edit and send email messages
Apache License 2.0
345 stars 336 forks source link

Attachment missing on iOS 13 Beta #337

Closed BKHines closed 4 years ago

BKHines commented 4 years ago

Is anyone else experiencing an issue with passing a photo as an attachment in iOS 13 Beta 2? It works on iOS12 (and Android 9), I've updated the iOS platform, camera plugin and the email composer plugin. The file string I'm sending in as an attachment comes from the getPicture method on the camera module and looks like the following:

file:///var/mobile/Containers/Data/Application/[GUID]/tmp/cdv_photo_002.jpg.

The email opens fine, no errors, the image saves to the photo album (I have that set to true) but no matter what, the image doesn't get attached to the email. Anyone else having this issue?

constructor(private email: EmailComposer) { }
...
let _email: EmailComposerOptions = {
  to: siteToEmail.email,
  subject: _subject,
  body: photodata.message,
  isHtml: true,
  app: 'mailto'
};

if (photodata.picurl) {
  console.log('app.component.ts', photodata.picurl);
  _email.attachments = [photodata.picurl];
}

  this.email.open(_email).then((res: any) => {
    this.alerts.messageAlert('Email opened fine: ${photodata.picurl}');
  }).catch((err) => {
    this.alerts.messageAlert('An email app could not be opened.  Is a default email app installed?');
  });
katzer commented 4 years ago

@BKHines I've tested it with iPadOS 13.1 and its working fine.

BKHines commented 4 years ago

@katzer Hmm, is that with the attachment URL format above: file:///var/mobile...? Or a different format? I also tried data URL and then a hard coded, base64 image data but those were not attached either.

katzer commented 4 years ago

I've used the camera plugin. So it's file:///var/mobile...

BKHines commented 4 years ago

I just had another developer test it on their iPad with 13.1 and it didn't work for them. However, on the 12.4 devices with the same code, it works fine.

Is it possible the app doesn't have permission to access file system? I noticed a section in the readme about Permissions on Android, but didn't notice anything related to iOS. Could iOS13 require external storage permission?

I'll be able to try it in a few hours when I work on it, but I'm just curious if your test required any extra permissions.

BKHines commented 4 years ago

Okay, I think this can be closed because it appears the camera plugin is providing an invalid FILE_URI on iOS13, similar to this issue: https://github.com/apache/cordova-plugin-camera/issues/492

Out of curiosity, @katzer you were able to get it to work using the camera plugin. Are you using this plugin? Latest version, 4.1.0?

katzer commented 4 years ago

Are you using this plugin? Latest version, 4.1.0?

Yes, latest plugin and platform version.

BKHines commented 4 years ago

Okay, thanks for the information @katzer; I appreciate it.