简体   繁体   中英

Sending email from webpage without any server side support

An HTML form has been filled out and now it's time to send the data via email. The server hosting the HTML is not running any server side scripting language like PHP, ASP, CGI etc. The owners don't want the email coming from outside of their walls, so no SMTP.js .

A fellow at work provided the SMPT server and port 25 and says to use Websockets, or to use Flash. I'm under the impression that port 25 is blocked by browsers, and they will need some kind of server side support to send an email. Alternatively, to use a mailto link to utilize their computer's email client.

Maybe I'm not up on current technologies. Are websocket the way to go? Don't they need a websocket server running to answer those calls?

Is there another solution to sending email from Javascript directly to an SMTP server?

Thanks to some highlighting, looks like I had SMTP.js confused with smtpjs, which just uses someone else's server to send mail. SMTPJS needs node.js, which they aren't running. Darn.

You are right about websockets. Its not a "tcp socket" you can use for smtp communication.

And if you could, you would have to make sure the clients can reach your smtp server. Many isp blocks port 25 to other servers then their own to reduce spam from their network. Forget about flash. Its dead and will give you the same problem with blocket smtp port.

I would solve this by using a web server with support for server side code. If you cannot move your webpage to that server, you can use cross site scripting to communicate with a server with support for server side code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM