Javascript IMAP 和 SMTP 客户端?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3775191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Javascript IMAP and SMTP client?
提问by Alexis
Is it possible to build a SMTP/IMAP client that can run in the browser that uses only Javascript?
是否可以构建一个可以在仅使用 Javascript 的浏览器中运行的 SMTP/IMAP 客户端?
采纳答案by user1397423
It's currently not possible to do in a normal web app in the browser. It is however possible to do in packaged apps with access to privileged apis:
目前无法在浏览器中的普通 Web 应用程序中执行此操作。但是,可以在具有访问特权 api 的打包应用程序中执行以下操作:
- Firefox Apps use the emerging W3C standard (TCPSocket): https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket
- Chrome Apps use a proprietary api (chrome.socket): https://developer.chrome.com/apps/socket
- Firefox 应用程序使用新兴的 W3C 标准 (TCPSocket):https: //developer.mozilla.org/en-US/docs/Web/API/TCPSocket
- Chrome 应用程序使用专有 api (chrome.socket):https: //developer.chrome.com/apps/socket
If you're looking for a battle proven library, whiteout.iodevelops and maintains a well tested IMAP / SMTP / MIME-codec implementation in pure JS:
如果你正在寻找一个经过战斗验证的库,whiteout.io开发和维护一个经过充分测试的 IMAP / SMTP / MIME 编解码器在纯 JS 中的实现:
It's MIT licensed and free to use.
它是 MIT 许可的,可以免费使用。
回答by Sripathi Krishnan
Agree with Daniel, its not possible in javascript.
同意 Daniel 的观点,这在 javascript 中是不可能的。
There is a new WebSocketsAPI that's going to be added to browsers to allow communication over sockets, but even after that is introduced it will NOT be possible. WebSockets API goes to great lengths to ensure such a thing is not possible, because it is a security risk.
有一个新的WebSocketsAPI 将被添加到浏览器中以允许通过套接字进行通信,但即使在引入之后它也不可能。WebSockets API 不遗余力地确保这样的事情是不可能的,因为它存在安全风险。

