react-native-mail icon indicating copy to clipboard operation
react-native-mail copied to clipboard

add attachment support for android

Open chirag04 opened this issue 10 years ago • 20 comments

chirag04 avatar Sep 14 '15 19:09 chirag04

Any progress with that?

avishayil avatar Jan 19 '16 18:01 avishayil

@avishayil Happy to accept PR for this.

chirag04 avatar Jan 19 '16 18:01 chirag04

I sent a PR, please review, it's not perfect but it's working.

avishayil avatar Jan 19 '16 22:01 avishayil

I need this too. Will this be implemented?

JumalDB avatar May 20 '16 05:05 JumalDB

Any updates on this?

amirfl avatar Jun 02 '16 14:06 amirfl

I made fork that supports multiple attachments for iOS.

I am in process of adding Android support for multiple attachments as well.

I also have HTML email for Android working but have not checked it in yet.

https://github.com/esutton/react-native-mail

I am happy to share work, however, I am not very fluent in git and may need assistance.

esutton avatar Jun 09 '16 13:06 esutton

I need attachment support in android as well. Happy to assist in any git issues

ujwal-setlur avatar Jan 21 '17 03:01 ujwal-setlur

@esutton happy to help. feel free to send PRs

chirag04 avatar Jan 30 '17 16:01 chirag04

I'm able to attach to Android just fine, but am having trouble attaching to iOS. I've submitted a question on stack overflow https://stackoverflow.com/questions/47086300/attach-image-to-email-in-react-native

But the fundamental issue seems to be that I'm getting back a uri value that looks like this (doesn't work as the full path)...

file://var/mobile/Containers/Data/Application/983938D-5304-463C-BD05-D033E55F5BEB/Documents/images/224CA6DD-5299-48C3-A7CF-0B645004535F.jpg

Instead of something that looks like this

/Users/anton/Library/Developer/CoreSimulator/Devices/9A15F203-9A58-41C5-A4FC-EA25FAAE92BD/data/Containers/Data/Application/79FF93F9-BA89-4F4C-8809-277BEECD447D/Documents/EFFF0ECE-4063-4FE5-984E-E76506788350.jpg

which would apparently work. If anyone has a clue how to resolve this, I would appreciate it.

geirman avatar Nov 02 '17 23:11 geirman

It works for me on both platforms. You may want to check my fork.

ujwal-setlur avatar Nov 03 '17 00:11 ujwal-setlur

With react-native-image- picker?

On Nov 2, 2017 5:28 PM, "Ujwal Setlur" [email protected] wrote:

It works for me on both platforms. You may want to check my fork.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chirag04/react-native-mail/issues/4#issuecomment-341596907, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkHfkShZYFH2Nrj8f3rjd4R8eehcXhnks5syl4QgaJpZM4F9FRK .

geirman avatar Nov 03 '17 00:11 geirman

Haven't tried it with that, thigh I use image pocket in another project. Should work though. If not, it is very likely some issue with leading /

ujwal-setlur avatar Nov 03 '17 01:11 ujwal-setlur

Sorry image pocket.

ujwal-setlur avatar Nov 03 '17 01:11 ujwal-setlur

Yeah I think the problem is with the way image picker Returns the path to the asset on iOS. I'm getting a file:// based path instead of a / based path

On Nov 2, 2017 6:05 PM, "Ujwal Setlur" [email protected] wrote:

Sorry image pocket.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chirag04/react-native-mail/issues/4#issuecomment-341601336, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkHfjOg7OCc3IVP1dzoOoWQYz8EkHSfks5symbbgaJpZM4F9FRK .

geirman avatar Nov 03 '17 01:11 geirman

Are you it's not the other way around? I am not quite sure. In my other project where I use image-picker, I had to do this:

 // Construct 'file://' URI if we have a raw path
    if (imagePath.startsWith("/")) {
      imagePath = "file:/" + image.path;
    }

ujwal-setlur avatar Nov 03 '17 01:11 ujwal-setlur

I'm pretty sure, unless I'm a complete bonehead. I always get back a file:// based uri

I've updated my stackoverflow question with logs to prove it. I provided a dump of the actual xcode logs. Here's the part I think you'd be most interested in...

2017-11-02 20:13:00.827 [info][tid:com.facebook.react.JavaScript] 'Response = ', { fileSize: 508257,
  data: REMOVED_BASE64_STRING
  timestamp: '2017-10-25T02:51:35Z',
  uri: 'file:///var/mobile/Containers/Data/Application/144D1C48-C6D5-475A-891A-F75360CD64E2/Documents/images/0EF09235-6E04-4799-86F5-3E996ED4E439.jpg',
  origURL: 'assets-library://asset/asset.JPG?id=EF345E7A-2DF1-49CA-875D-4208976A635B&ext=JPG',
  isVertical: false,
  height: 768,
  width: 1024,
  fileName: 'IMG_0003.JPG' }

geirman avatar Nov 03 '17 03:11 geirman

Interesting. The mail component should have worked then I think. Will run some tests tomorrow.

ujwal-setlur avatar Nov 03 '17 04:11 ujwal-setlur

I'd really, super appreciate that.

geirman avatar Nov 03 '17 04:11 geirman

+1

It's working fine in the iOS mobile. But not working in the Android Mobile.

recepkocur avatar Nov 19 '18 11:11 recepkocur

Please help someone else not working ios

sash52 avatar Feb 07 '19 12:02 sash52