chirag04 / react-native-mail

A wrapper on top of MFMailComposeViewController from iOS and Mail Intent on android
MIT License
445 stars 249 forks source link

Multiple file attachments not working #167

Closed sankar9659 closed 1 year ago

sankar9659 commented 3 years ago

Multiple file attachment not working for both android and ios, any solution for this issue?

my code is:

      `Mailer.mail({
            subject: 'Artwork Details',
            recipients: ['support@example.com'],
            ccRecipients: ['supportCC@example.com'],
            bccRecipients: ['supportBCC@example.com'],
            body: `${artwrks.title}`,
            customChooserTitle: "This is my new title", // Android only (defaults to "Send Mail")
            isHTML: true,
            attachments: [{
                path: '/data/user/0/com.galleryassistant/cache/11025/image_1611136953276',
                type: 'jpg', 
               path: '/data/user/0/com.galleryassistant/cache/11025/image_1611136953276',
                type: 'jpg',
            }],
        }, (error, event) => {
            Alert.alert(
                error,
                event,
                [
                    { text: 'Ok', onPress: () => console.log('OK: Email Error Response') },
                    { text: 'Cancel', onPress: () => console.log('CANCEL: Email Error Response') }
                ],
                { cancelable: true }
            )
        });`

Thanks in advance.

scblason commented 3 years ago

It seems that the attachments are not properly defined, should be:

Mailer.mail({
            subject: 'Artwork Details',
            recipients: ['support@example.com'],
            ccRecipients: ['supportCC@example.com'],
            bccRecipients: ['supportBCC@example.com'],
            body: `${artwrks.title}`,
            customChooserTitle: "This is my new title", // Android only (defaults to "Send Mail")
            isHTML: true,
            attachments: [{
                 path: '/data/user/0/com.galleryassistant/cache/11025/image_1611136953276',
                 type: 'jpg', 
                }
               { 
                path: '/data/user/0/com.galleryassistant/cache/11025/image_1611136953276',
                type: 'jpg',
            }],
        }, (error, event) => {
            Alert.alert(
                error,
                event,
                [
                    { text: 'Ok', onPress: () => console.log('OK: Email Error Response') },
                    { text: 'Cancel', onPress: () => console.log('CANCEL: Email Error Response') }
                ],
                { cancelable: true }
            )
        });