使用JavaScript将HTML5 WebSQL数据库的内容附加到电子邮件 [英] Attach content of HTML5 WebSQL database to email using javascript

查看:40
本文介绍了使用JavaScript将HTML5 WebSQL数据库的内容附加到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用HTML5创建了本地数据库(WebSQL).本地存储的内容必须作为附件发送到电子邮件中.电子邮件客户端将使用javascript mailto功能打开.

I have created local DB (WebSQL) in HTML5. The content of the local storage has to be sent as an attachment in an email. The email client will be opened using javascript mailto feature.

要求是,当电子邮件客户端打开时,应在电子邮件客户端窗口中将本地存储的内容作为文件(以xml,csv或text等任何文件格式)附加.

The requirement is when the email client opens it should have the content of the local storage attached as a file (in any file format like xml, csv or text) in the email client window.

据我了解,必须先将内容导出到文件中,然后再附加到电子邮件中.可以使用HTML5的File API来完成此操作吗?

As I understand, the content will have to be exported to a file first and then attached to email. Can this be done using File API of HTML5?

我的问题是-是否可以使用javascript做到这一点?

My question is - Is it possible to do this using javascript?

我的问题是它必须完全在客户端完成.至少有一种方法可以使用javascript将本地数据库内容导出到文件中?然后可以将该文件手动附加到电子邮件中.

My problem is that it has to be done entirely on the client side. Is there at least a way to export the local db content into a file using javascript? This file then can be manually attached to the email.

推荐答案

我假设您正在谈论做这样的事情(从WebSQL中提取信息之后):

I will assume that you are talking about do something like this (after extract the info from the WebSQL):

document.location = "mailto:"+recipient+"?attach="+"attach.zip";

根据 RFC 2368 ,您不能在其中添加附件出于安全原因,带有mailto:URL方案的邮件:

如果任何标题被认为是危险的,则解释mailto URL的用户代理应该选择不创建消息;它也可以选择仅使用URL中给定的标头的子集来创建消息.只有主题,关键字和正文标头被认为既安全又有用.

The user agent interpreting a mailto URL SHOULD choose not to create a message if any of the headers are considered dangerous; it may also choose to create a message with only a subset of the headers given in the URL. Only the Subject, Keywords, and Body headers are believed to be both safe and useful.

结论:

mailto:仅支持标题值或文本/纯文本内容.

Conclusion:

mailto: only supports header values or text/plain content.

如果您使用的是C#,则可以使用这个班

If you are using C# you can use this class

对于任何其他服务器端语言,我99%确信有一种方法可以做到这一点.

For any other server side language I'm 99% sure that there is a way to do this.

这篇关于使用JavaScript将HTML5 WebSQL数据库的内容附加到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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