在Android的电子邮件正文中发送带有数据库表的HTML电子邮件 [英] Sending Html email With database table in email body in android

查看:111
本文介绍了在Android的电子邮件正文中发送带有数据库表的HTML电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,其中有一个包含两列(产品,价格)的sqlite表.我想将此表插入电子邮件正文并发送电子邮件.我在一些文档中读到,Android不支持该表标记,因此我尝试在string.xml中使用div标记,但无法正常工作.我可以使用电子邮件正文发送带有文本的邮件,但无法携带表格格式.我使用了以下代码,

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

推荐答案

连接到存储模板并为电子邮件生成HTML的服务,然后从该服务发送电子邮件.

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

您可以构建自己的服务,也可以使用Mandrill,SendGrid或Mailjet之类的东西.

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

这篇关于在Android的电子邮件正文中发送带有数据库表的HTML电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆