Sending HTML formatted email in Android - java

I have successfully created an Android app that calculates prices and then is able to transfer that data in a preformatted fashion to an email program of the users choice. Depending upon the data the user creates in the app, a string containing the HTML is read into an intent. The code I have for this is:
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailText));
QuoteDroid.this.startActivity(emailIntent);
This is all fine and the email is mostly formated correct when I choose the Gmail app, and generally sends mostly correct. The issue I have with this is that I must send it from a non-gmail account for business purposes. When I choose the generic email app on the phone it does not process the HTML properly and when I send the email it is formated in plain text.
I've read through countless articles and forum posts, but to no avail. How do I process the string, containing the HTML, in such a way that the email -after being sent with the built in email app- is viewed properly formated by the receiver?

It's up to the individual mail app to properly handle the String that it receives as the EXTRA_TEXT. A well-behaved mail app will see the mimetype and handle the EXTRA_TEXT appropriately, but not all mail apps do.

Related

Why am I not able to read the complete email body using Exchange Web Service Java API?

I am using EWS Java API to read and process emails. One such email contains few conversation and a MS Teams meeting information at the end. While reading such an email, the EmailMessage.getBody() returns only the MS Teams meeting information and all the other contents of the email body are ommitted. Sample code below:
EmailMessage message = EmailMessage.bind(service, new ItemId(item.get(nMessagePos).getId().getUniqueId()));
String emailBody = message.getBody().toString()
I tried setting the BodyType property to both HTML and Text and then fetched the body of the email but it still returns only the Meeting invite details.
Is there any specific reason for this and is there a way for me to get the complete email body?
I would try to enable tracing https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-trace-requests-responses-to-troubleshoot-ews-managed-api-applications or look at the actually soap responses your getting it could be a parsing issue at the client side (eg bug in the library). You could also try getting the Mimecontent of the Message instead and then parse back the body from that content. Something like EWSEditor might be useful for trying to diagnose what is going on it will show you what the responses look like and allow you to test mimecontent etc without needing to write any code https://github.com/dseph/EwsEditor/releases.

How To Send HTML Attachment With Android(Java)

I'm trying to create POS Android Application, I added feature that after a order submitted the app send the order invoice with email to the customer.
My problem is how to create this invoice with unfixed number of data presented in the invoice so I can send it through email?.
Similar To This One:
by the way I'm using java email API.
You can try StringTemplate to use email templating.

Is it possible to get details of the email for which user had replied?

I am using amazon SES to send notification emails in my project. When a user replies back to this email I want to trigger some actions (like a ticket creation or update). Is it possible to know the contents or headers of the email for which user is replying ?
If the replying user's email system supports it (most do), you should receive an In-Reply-To: Header containing the message-id of the email you sent. If you kept that message (along with the message id) you can use this to retrieve original email.
Sometimes the Refereces: Header might be useful as well

Add an event to client calendar through an email

I have absolutely no idea about how it can be done.
All i have is a mail sending function
sendEmail(List<String> to, String subject, String text)
How can i create an event notification email and forward it to the client, so that client
can add the event to his calendar by clicking an Yes Button
No Javascript is allowed in most of the email clients. So a Button is not helpful to your purpose.
I think the best way is to generate a .ics file and attach it to your email. Most of the email client (like Gmail) can find it and display as a part of email body. Usually, it will has an "add to calendar" link which is generated by email client for this .ics file.
Here is a reference to .ics file format. http://en.wikipedia.org/wiki/ICalendar

User Name in Spring Send Mail API

How to pass the different user name instead of displaying the from email name in mail received to the end user java send mail API.
Atleast you can google first for your question. Anyways refer this.

Categories