Trying to send email using the grid sent to my app.
AsyncTask I is the following code
SendGrid sendgrid = New SendGrid ("XXXXXX", "YYYYYY"); PublishProgress ("Preparing mail message ...."); SendGrid.Email Email = New SendGrid.Email (); Email.setFrom (args [0] .toString ()); Email.addTo (args [2] .toString ()); Email.setSubject (args [3] .toString ()); Email.setText (args [4] .toString ()); // androidEmail.createEmailMessage (); Published progress ("sending email ..."); Try {Sendgrid.send (email); } Hold (SendGridException e) {System.out.println (e); Log.i ("SendGrid Exception", "Mail Not Sent"); } Published progress ("Email Sent");
When I run it, I get the following error:
by: java.lang.NoSuchField error: org.apache.http .message.basicLineFormatter At org.apache.http.impl.io.DefaultHttpRequestWriterFactory On & lt; Init & gt; (DefaultHttpRequestWriterWitter.java:52) at org.apache.http.impl.io.DefaultHttpRequestWriterFactory & Lt; Init & gt; (DefaultHttpRequestWriterWitter.java:56) at Org.apache.http.impl.io.DefaultHttpRequestWriterFactory & Lt; Clinit & gt; (DefaultHttpRequestWriterFactory.java:46) at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory. & Lt; Init & gt; ORG (ManagedHttpClientConnectionFactory.java:72) Apache.http.impl.conn.ManagedHttpClientConnectionFactory & Lt; Init & gt; (ManagedHttpClientConnectionFactory.java:84) at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory. & Lt; Clinit & gt; (ManagedHttpClientConnectionFactory.java59) at org.apache. Http.impl.conn.PoolingHttpClientConnectionManager $ InternalConnectionFactory Org.apache.http.impl.conn.PoolingHttpClientConnectionManager at & lt; Init & gt; (PoolingHttpClientConnectionManager.java:493) org.apache.http.impl.conn.PoolingHttpClientConnectionManager. On & lt; Init & gt; (PoolingHttpClientConnectionManager.java:149). Init & gt; (PoolingHttpClientConnectionManager.java:138) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager. & Lt; Init & gt; (PoolingHttpClientConnectionManager.java:114) at org.apache.http.impl.client.HttpClientBuilder.build (httpTPTIT Builder. Java: 726) at com.sendgrid.SendGrid. & Lt; Init & gt; (SendGrid.java59) I downdload send-grod.jar to my github page I tested it with the sample Java program and I can send mail successfully but it is not working in Android
What am I missing?
I understand the reason for behavior.
Some dependency libraries used on the adiod will not work on Android.
So I used Maven to make all my jars with all the recurred libraries that work on Android.
Finally I can send emails from my app.
Two links:! And! Were helpful.
Comments
Post a Comment