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

查看:839
本文介绍了使用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 attched 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 atleast 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中给出的标题子集的消息。只有Subject,Keywords和Body标题被认为既安全又有用。

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:仅支持标题值或text / plain内容。

Conclusion:

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

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

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天全站免登陆