Android uses Microsoft EWS to send emails and androidews to send emails

Source: Internet
Author: User

Android uses Microsoft EWS to send emails and androidews to send emails

Generally, we use javamail in android to send emails, but many times we need to connect to the Exchange Service (which is used by many internal email servers and has not activated the smtp service, at this time, we will use Microsoft's ews-java-api. The official github address is https://github.com/officedev/ews-java-api. Then add 2.0 dependencies and build in android studio according to the given method. At this time, an error is reported when compilation fails.

The content is as follows:

  

Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.client.protocol.HttpClientContext" on path: DexPathList[[zip file "/data/app/domain.test.android.jasonyu.myfirstapp-2/base.apk"],nativeLibraryDirectories=[/data/app/domain.test.android.jasonyu.myfirstapp-2/lib/x86, /vendor/lib, /system/lib]]    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)    at microsoft.exchange.webservices.data.core.ExchangeServiceBase.initializeHttpContext(ExchangeServiceBase.java:261)     at microsoft.exchange.webservices.data.core.ExchangeServiceBase.setUseDefaultCredentials(ExchangeServiceBase.java:677)     at microsoft.exchange.webservices.data.core.ExchangeServiceBase.<init>(ExchangeServiceBase.java:173)     at microsoft.exchange.webservices.data.core.ExchangeService.<init>(ExchangeService.java:3718)     at domain.test.android.jasonyu.myfirstapp.MainActivity.onButtonGoClick(MainActivity.java:94) 


The possible reason is that this api is for java web. If you want to use android, you need to use another android package: https://github.com/alipov/ews-android-api.

Compile the ews-android-api.jar through git. Then add the dependency to the project:
Compile files ('libs/ews-android-api.jar ') compile 'joda-time: joda-time: 8080'

OK.


  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.