|
|
|
|
2
|
|
2
|
|
3
|
Always wanted to implement a contact form in your website and/or portfolio, but don't want to busy yourself with something too complex (mail sending in PHP, for example, is a complete mess)? Here's a miracle solution for ya! Just run the nodemailer-based app, include a JavaScript file in your HTML page, and you're all set :wink:
|
3
|
Always wanted to implement a contact form in your website and/or portfolio, but don't want to busy yourself with something too complex (mail sending in PHP, for example, is a complete mess)? Here's a miracle solution for ya! Just run the nodemailer-based app, include a JavaScript file in your HTML page, and you're all set :wink:
|
4
|
|
4
|
|
5
|
-## Install
|
|
|
|
|
5
|
+## Install and run
|
6
|
|
6
|
|
7
|
Just clone this repository, edit the `settings.json` file (described below) and run the server:
|
7
|
Just clone this repository, edit the `settings.json` file (described below) and run the server:
|
8
|
|
8
|
|
|
|
|
|
19
|
PORT=8080 npm start
|
19
|
PORT=8080 npm start
|
20
|
```
|
20
|
```
|
21
|
|
21
|
|
|
|
22
|
+Same goes with the host. Without further instructions, the server will listen on 0.0.0.0, which means it will accept every connection, whatever the source. You can override this by using the `HOST` environment variable:
|
|
|
23
|
+
|
|
|
24
|
+```bash
|
|
|
25
|
+HOST=127.0.0.1 npm start
|
|
|
26
|
+```
|
|
|
27
|
+
|
|
|
28
|
+So, if we want our server to only listen to requests from its host, on the 8080 port, we'll start the server like this:
|
|
|
29
|
+
|
|
|
30
|
+```bash
|
|
|
31
|
+HOST=127.0.0.1 PORT=8080 npm start
|
|
|
32
|
+```
|
|
|
33
|
+
|
22
|
Obviously, you'll need Node.js and NPM (or any Node.js package manager) to run the app. As we're launching a webserver (which will serve the necessary files and process the mail sending requests), this app will run continuously. One good practice would be to run it as a daemon (in a systemd service, for example).
|
34
|
Obviously, you'll need Node.js and NPM (or any Node.js package manager) to run the app. As we're launching a webserver (which will serve the necessary files and process the mail sending requests), this app will run continuously. One good practice would be to run it as a daemon (in a systemd service, for example).
|
23
|
|
35
|
|
24
|
## Usage
|
36
|
## Usage
|