简体   繁体   中英

Sending Html email With database table in email body in android

I am developing an android app in which i have a sqlite table containing two columns(Product,price). I want to insert this table in the email body and send an email.I read in some docs that table tag is not supported in android so i tried using div tag in string.xml but is not working. I can send a mail with texts in email body but could'nt bring table format. I used the below code,

String formattedText = getString(R.string.htmlFormattedText);
Intent emailIntent2 = new Intent(android.content.Intent.ACTION_SEND);
String[] recipients2 = new String[]{"xxx@gmail.com", "",};
emailIntent2.putExtra(android.content.Intent.EXTRA_EMAIL, recipients2);
emailIntent2.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sample mail"); 
emailIntent2.putExtra(android.content.Intent.EXTRA_TEXT,Html.fromHtml(formattedText));
emailIntent2.setType("text/html");
startActivity(Intent.createChooser(emailIntent2, "Send mail client :"));

How can i show the table format in email body.If it is not possible please tell me what is the alternate for this. Thanks in advance

Connect to a service which stores the template and generates the HTML for the email, and send the email from that service.

You can either build your own service, or use something like Mandrill, SendGrid or Mailjet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM