Open maendamedia opened 4 years ago
@maendamedia Unfortunately this lib doesn't yet support loading attachments that are not in the filesystem of the device. The crop library you are using, has a writeTempFile (ios only)
option that you are probably using, but works only on ios. So in android, there is no tmp file in the filesystem, and it can't be loaded. A workaround, will be to save the file yourself in a tmp folder, and then load it with this library.
@angelos3lex Just like @maendamedia, Im using react-native-image-crop
to take a photo, after that I save the img using @react-native-community/cameraroll
and then I call smtp but I get this error IOException while sending message
I guess it relates to #23
The path that is returned from saving the photo to the library is: content://media/external_primary/images/media/9624
My code:
ImagePicker.openCamera({
width: 300),
height: 400)
}).then(image => {
console.log(image)
CameraRoll.saveToCameraRoll(image.path).then(path => {
console.log(path)
RNSmtpMailer.sendMail({
mailhost: 'email-smtp.us-east-1.amazonaws.com',
port: '587',
ssl: false,
username: 'host.userName',
password: 'host.password',
from: 'host.email@gmail.com',
recipients: 'my.email@gmail.com',
subject: service,
htmlBody: '<p>body</p>',
attachmentPaths: [path + '.jpg'],
attachmentNames: ['image.jpg'],
attachmentTypes: ['img']
})
.then(success => {
if (step === curStep) {
console.log(success)
dispatch(nextStep())
alert(success)
}
})
.catch(err => console.log(err))
})
}).catch(error => { console.log(error) })
Am I missing something here?
Why do you append .jpg
on the path and you don't trust exactly what the camera-roll lib returns? Could you try that as well?
@angelos3lex The outcome is the same, I thought because camera-roll's path doesnt specify file type it would fail. I'll try react-native-fs
and get back to you
@angelos3lex @LuizFBrisighello im having the same issue with android. showing me IOexception while ios is working fine any leads? the path is correct . im picking an image from gallery through react-native-image-picker, not working with camera either.
@yasirwahid I ended up moving to other tasks without solving the attachments issue. react-native-fs
doesnt do the right behaviour for me..
Could you guys check if the solution proposed by samuelj1323 in #23 is the reason behind this prob?
Hello,
Like your module and iOS works great. For android it is not so easy :)
I let the user select some images using the react-native-image-crop module and store them in an array. This array will be filtered and attached tot the smtp email .
As mentioned, iOS works great, but on android i get the famous IOExeption.
What am i doing wrong here: