HTML5   发布时间:2022-04-25  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了[HTML5] Can I use HTML5 to send a client-side email?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

摘要:[HTML5] Can I use HTML5 to send a client-side email?


http://stackoverflow.com/questions/5467395/can-i-use-html5-to-send-a-client-side-email

Question

I want to send an email in HTML5. I don‘t want to force the user to open a mail client,I want to send the email directly from the web page.

On a side note,is there any way at all to do this in JavaScript? I kNow it‘s probably not possible,just wondering if there are any crafty ways to pull it off going completely through the client.

==============================================================================================================

Answer

Yes it is possible. But not practical See Edit 2 ?(可以,但是要用到些小贱招)

Some HTML5 implementations include support for websockets(websockets教学),essentially a tcp connection to a server. Overlay some send/recv code and you can build a SMTP client.

In fact it looks like nodejs and websocket support has been used to implement a smtp client?... see here ...?(= =很硬的link)

you would still need a smtp server,username,password,etc just like a standard smtp client in order for it to work.

Using this method for spam would be unlikely as your smtp provider Could easily cancel your account.

=== EDIT ===

Actually you Could build a server less version,it would have to also implement name server lookups to find mx records. Chances are however that any decent SMTP servers maintain spamlist blacklist tables and connecTing from an random ip address would see the email commonly marked as spam.

Also talking to smtp servers that require secure mail connections Could be difficult.

As others have mentioned there are malicIoUs uses to this implementation like sending spam. I guess it is possible you Could be a HTML5 botnet creator but I would have thought that you would kNow most of this already :)

=== EDIT 2 ===

As Mark At Ramp51 mentioned,Handshaking is required with websockets. This was something I wasn‘t aware of. you would have to hack the websocket implementation to bypass handshaking.

The correct way is to have the web server forWARD the email.

=============================================================================================================================

In short NO not directly from the client (excluding hacks).

you Could make an ajax call to your server and send an email.

the problem with doing it from the client and not using a mail client is complicated. For example most consumer ISPs have their own SMTP relay that all outbound mail on port 25 must be transmitted over. you website will have trouble obtaining the proper information to do this. Secondly the webbrowser doesn‘t understand the SMTP protocol and neither does the XMLhttprequest object.

So if you are a hacker ninja,maybe you can figure something out with ActiveX,Java Applets,or flash,but you basically would have to be operating directly with a tcp socket and issuing SMTP protocol commands over that socket.

There are many obstacles to overcome,in fact I don‘t kNow how to do it,but where there is will there is a way. Don‘t be surprised that if you do find a hack,it may be plugged swiftly by the major browser vendors.

=============================================================================================================================

This is not possible.

Instead,you should use AJAX to send the email on the server.

=============================================================================================================================

You can‘t send the email using JavaScript alone. You‘ll need some form of server side processing (PHP,ASP,etC) to send the actual email.

There‘s a good tutorial on setTing up an ajax form here:?http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/

It doesn‘t include the PHP (or ASP,etC) for sending the email,but there are plenty of tutorials out there for how to send an email using PHP.


=============================================================================================================================

You can‘t do it purely through client side code.

you can do it with a server callBACk,AJAX.


http://www.plurk.com/SophieQ

原文:大专栏  [HTML5] Can I use HTML5 to send a client-side email?

大佬总结

以上是大佬教程为你收集整理的[HTML5] Can I use HTML5 to send a client-side email?全部内容,希望文章能够帮你解决[HTML5] Can I use HTML5 to send a client-side email?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。