Sending Html email With database table in email body in android

徘徊边缘 提交于 2019-12-12 17:18:58

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/21037925/sending-html-email-with-database-table-in-email-body-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!