jakebreen / android-sendgrid Goto Github PK
View Code? Open in Web Editor NEWA simplified Android email library utilising SendGrid's v3 API that targets minSdkVersion 16
License: Apache License 2.0
A simplified Android email library utilising SendGrid's v3 API that targets minSdkVersion 16
License: Apache License 2.0
I'm getting response code 0
and Error parsing error message: Value Unable of type java.lang.String cannot be converted to JSONObject
. It was working perfectly before. Here is my code
SendGrid sendGrid = SendGrid.create(dao.getConfiguration(ThermalogConstants.CONFIG_API_KEY));
SendGridMail mail = new SendGridMail();
mail.addRecipient("[email protected]", "name");
mail.setFrom("[email protected]", "name");
mail.setSubject("Alert Warning");
String title = "Alert Warning ";
SpannableStringBuilder strBold = new SpannableStringBuilder(title);
strBold.setSpan(new StyleSpan(Typeface.BOLD),
0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
mail.setContent("ok");
try {
SendTask task = new SendTask(sendGrid, mail);
SendGridResponse response = task.execute().get();
Log.d("Response", "run: "+response.getCode());
Log.d("Response", "run: "+response.getErrorMessage());
} catch (Exception e) {
Log.d(TAG, "sendEmail: " + e);
Log.d("Response", "error: "+e.toString());
}
}
Hello,
As the question suggests, I am trying to find a way to specify an unsubscribe group to associate with the email. Is there any way to do that? Thank you in advance!
Sincerely,
Iraklis Eleftheriadis
Hi, I tried the workaround, It worked this time.
But I am getting mail in basic text format (NOT HTML) Like this
But My Template is similar to this
Soruce
SendGridMail mail = new SendGridMail();
mail.addRecipient(email, name);
mail.setFrom("[email protected]", "Rent House Manager Pro");
mail.setSubject("Welcome to Rent House Manager Pro");
mail.setContent(""); //Tried this one too mail.setContent(" ");
mail.setTemplateId("API_KEY");
// JSONObject structured into key/value pairs
final JSONObject templateData = new JSONObject();
try {
templateData.put("first_name", "Hitesh Verma");
mail.setDynamicTemplateData(templateData);
} catch (JSONException e) {
e.printStackTrace();
Log.d("HIT_TAG", "Err : " + e.getMessage());
}
SendTask task = new SendTask(sendGrid, mail);
try {
SendGridResponse response = task.execute().get();
toastHelper.toastInfoMsg("Code " + response.getCode()); //this is 202
Log.d("HIT_TAG", "SendGrid : " + response.getErrorMessage()); //This is now null
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
Am I Doing Something Wrong?
Originally posted by @itshiteshverma in #10 (comment)
mail.setDynamicTemplateData(@NonNull JSONObject jsonObject)
// JSONObject structured into key/value pairs
final JSONObject templateData = new JSONObject();
templateData.put("forename", "Jane");
templateData.put("surname", "Doe");
templateData.put("message", "Hello, This is my email");
mail.setDynamicTemplateData(templateData)
This returning response code 400
I tried to send a email with this code:
SendGridMail sendGridMail = new SendGridMail();
sendGridMail.addRecipient("[email protected]", "myName");
sendGridMail.setFrom("[email protected]", "myName");
sendGridMail.setSubject("Subjet");
sendGridMail.setContent("MyMessage");
But it didn't show "MyMessage" in that email!
Am i doing something wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.