How do you make a automatic email form?
RohilPatel (116)

Hi, I have been trying to make a form that will send data to be via email. Does anyone know how to do this?

You are viewing a single comment. View All
ArchieMaclean (662)

What language are you using? You will have to be using a backend language like PHP or Django with python - using javascript you can't send mail.

For PHP, check out the mail function.
For Django you can use send_mail.

You may be able to send mail with Node.JS, I'm not sure as I haven't used it.

Please upvote if this helps :)

RohilPatel (116)

@ArchieMaclean
I’m probably using php. Can you help with that?

timmy_i_chen (1001)

@ArchieMaclean Quick note - you can write backends with javascript. :) e.g. create a new express repl

TheDrone7 (643)

@timmy_i_chen and @ArchieMaclean and @RohilPatel try using smpt.js it enables you to send mail via front-end javascript. No need for a back-end.

RohilPatel (116)

@TheDrone7

But I don’t want personal info online

ArchieMaclean (662)

@RohilPatel yes, good point. PHP on repl doesn't work very well (normally you can put html tags within the PHP file, but that doesn't work). I would recommend timmmy chen's method or Django - however, these both would require you to learn how to use that backend.

TheDrone7 (643)

@RohilPatel I don't see how you'll be leaking your personal info online using that. I've used it myself quite a lot, it's safe. Although it's only recommended if you don't want to get started with backend using node.js or python.

ArchieMaclean (662)

@TheDrone7 So long as you use the SecureToken.

RohilPatel (116)

@TheDrone7

Alright, can you explain how you do it then?

TheDrone7 (643)

@RohilPatel Just visit their website, it has all the instructions you will need there - https://www.smtpjs.com/ . Unfortunately being on phone I cannot do much else.

RohilPatel (116)

@TheDrone7

Does repl have a smug server?

TheDrone7 (643)

@RohilPatel I'm not sure what you mean by that.

ArchieMaclean (662)

@RohilPatel Do you mean an smtp server? No.
You'll need to set up one, I recommend SendGrid because it's free. It's fairly self explanatory; sign up then start an smtp relay. (Not api)

RohilPatel (116)

@ArchieMaclean
Ok. So I will check it out. And yes, I meant smpt server

RohilPatel (116)

@ArchieMaclean

So I got to the step where it wants me to “Configure your application with the settings below.” How do you do this?

ArchieMaclean (662)

@RohilPatel you need to set up your email thing with the settings - host name (see the smtp page)

ArchieMaclean (662)

@RohilPatel Do you hace a SecureToken? like this:

ArchieMaclean (662)

@RohilPatel just set a variable like var SecureToken= then your secure token.