Sending email with JavaScript

I’m trying to send an email with JavaScript, pretty simple: I’m using smtp.js Email.send function. The problem is Google very recently disabled all “less secure apps” from accessing Gmail accounts, so this no longer works. I can’t find anything online for sending emails with JS after this update. Does anyone know how to do this since the update?
Note: The solution must work in a HTML/CSS/JS website project, so no NodeJS (i think)

Here’s an example on how to send mail using Replit smtp servers
https://replit.com/@LuisAFK/Nodemailer-Direct-Transport?v=1

Thanks, I see this is in NodeJS, so is it possible to use in my HTML/CSS/JS project?

I don’t think so unfortunately.

i think it is possable to use node.js in html/css/js ive done it.

how exactly did you do it?

just make a normal .js file, i think replit will detect what js it is

That won’t work if your Repl is HTML,CSS,JS

look at this forgot what it does and how it works but i think it node.js sorry if not though https://replit.com/@Devolex/test-site?v=1

The index.js script doesn’t work since it is NodeJS in a HTML Repl.
And even if you found an API that can be called using pure JS, you wouldn’t able to hide the API keys…

here just look at server.js in files,
https://replit.com/@Devolex/account-test-system-for-devolex?v=1#server.js
i think this work i remember it working

Less secure apps has been replaced with a new solution called app password, so you can still make it work.

You just need to setup MFA in your Google security settings, then you should see a section to create app passwords.

When you create an app password, choose the “Mail” app type and “Other” device type and name it something you’ll recognise like the name of your app.

It’ll then give you a special password that you’ll use in combination with your Gmail address (rather than your normal password).

I have a Repl that does exactly this… https://replit.com/@robsd/Form-to-Email


1 Like