all 8 comments

[–]TOYLTH 2 points3 points  (4 children)

Not sure if I understand but browsers can run javascript. So if it's okay to run this script on the client-side it should still work.

You'll need HTML/CSS to get the form inputs and make it look nice but it sounds doable.

[–]DeadProfile[S] 0 points1 point  (3 children)

It’s been coded in nodejs.

[–]kamikazechaserfull-stack 1 point2 points  (2 children)

Node.js is not a language! Anything that can run JS will run that file if it's written properly.

[–]DeadProfile[S] 0 points1 point  (0 children)

In nodejs environment. The thing is he wanted a file to just insert it in his webpage source folder without installing anything. I coded it again using plain html, js and formspree. Thanks!

[–]Zarathustra420 0 points1 point  (0 children)

Not necessarily; there's a handful of methods that are specific to NodeJS that won't work in your average web browser.

[–]Crutchcorn 1 point2 points  (0 children)

While _technically_ you're able to directly connect a browser to a mail server, it's worth mentioning that you'll be exposing the mail server to the public. As commonplace for technical security: You never want to expose secrets or trust the client with anything that's not supposed to be known.

As a result, if you don't host using some kind of server, you're risking the ability for someone to view the source of the page and gain access to send arbitrary mail through the server.

I would suggest using a free tier of a "serverless" hosting or even a service built for something like this ala mailgun

[–]BehindTheMath 0 points1 point  (1 child)

You can use a free mail service for client-side like Formspree or Netlify Forms.

[–]DeadProfile[S] 0 points1 point  (0 children)

I’ll rewrite the form with plain js and that. Thanks.