angelos3lex / react-native-smtp-mailer

Send emails by connecting to smtp server+attachments, using android javamail and ios mailcore2
39 stars 32 forks source link

Support for android 11(30) #54

Open AlenToma opened 2 years ago

AlenToma commented 2 years ago

The app crash when I build it for API 30 and running it on android 11.

The jar files are not supported anymore.

I have fixed my fork but wanted to tell anyone who is having the same issue, or maybe you would like to have a look at the changes I did.

On android build.grade I removed implementation fileTree(dir: 'libs', include: '*.jar') and added

    implementation 'com.sun.mail:android-mail:1.6.6'
    implementation 'com.sun.mail:android-activation:1.6.6'

I also added the following options under android.

   packagingOptions {
        exclude 'META-INF/mimetypes.default'
        exclude 'META-INF/mailcap.default'
    }

All the credit goes for the following site https://issuetracker.google.com/issues/172544275?pli=1 I found the solution there.

mrkprdo commented 2 years ago

Will this fix this error?

Rejecting class com.sun.mail.handlers.text_plain that attempts to sub-type erroneous class com.sun.mail.handlers.handler_base
AlenToma commented 2 years ago

Yes, its exactly the error that it fixes

mrkprdo commented 2 years ago

Yes, its exactly the error that it fixes

I tried your solution but still did not work on my end. Any thoughts whats causing this error?

AlenToma commented 2 years ago

It did work for me, try and install my fork and test it npm install https://github.com/AlenToma/react-native-smtp-mailer.git As for why, you can read about this here https://issuetracker.google.com/issues/172544275?pli=1

mrkprdo commented 2 years ago

Ok, got it to work. As i later understand that changes should be applied to the library build.gradle, not the main app build.gradle. Thanks!

DDAmine commented 2 years ago

@AlenToma hi , it used to work fine on android <android 11 but since i applied the changes i keep getting back an error of Authentication failed, i did check my id and pw over 20 time no clue what could be the problem

AlenToma commented 2 years ago

There is a setiings you have configurate on Gmail. if you are using it on with Gmail. Other wise i have no idea why.

DDAmine commented 2 years ago

@AlenToma my bad all good , u are a lifesaver , just to clarify you add the code below in the project-name/android/app/build.gradle

   packagingOptions {
        exclude 'META-INF/mimetypes.default'
        exclude 'META-INF/mailcap.default'
    }

and you add this code in node_modules/react-native-smtp-mailer/android/build.grade

    implementation 'com.sun.mail:android-mail:1.6.6'
    implementation 'com.sun.mail:android-activation:1.6.6'
supawitbeat commented 2 years ago

It did work for me, try and install my fork and test it npm install https://github.com/AlenToma/react-native-smtp-mailer.git As for why, you can read about this here https://issuetracker.google.com/issues/172544275?pli=1

It's Worked! thank you .

IsharaJaylath commented 1 year ago

I am getting Error:IO Exception while sending message without attaching any file or document. Ive use npm install https://github.com/AlenToma/react-native-smtp-mailer.git this fork.

kd-fs commented 1 year ago

Hi, When I build, I [have this error: Task :app:mergeDebugJavaResource FAILED

image_2023-01-26_110148794

How solve this plese ?

kd-fs commented 1 year ago

I solve this by replace.

packagingOptions { exclude 'META-INF/mimetypes.default' exclude 'META-INF/mailcap.default' }

with

packagingOptions { resources.excludes.add("META-INF/*") }

kd-fs commented 1 year ago

I am getting Error:IO Exception while sending message without attaching any file or document. Ive use npm install https://github.com/AlenToma/react-native-smtp-mailer.git this fork.

I have same error.

kd-fs commented 1 year ago

when I attach the file it doesn't work either.

markusgabriel commented 1 year ago

I am using this in a managed expo project. Should I prebuild the project and then make the changes in these files? Or should I write a config plugin for it? I know I probably should ask this in an expo thread, but I think I'm not the only one with that setup while using this tool.

dhavalsigma commented 15 hours ago

Exception

I am also getting the same error, any one have a solution? [Error: IOException while sending message]