|
@@ -0,0 +1,94 @@
|
|
1
|
+# SMAM (Send Me A Mail)
|
|
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:
|
|
4
|
+
|
|
5
|
+## Install
|
|
6
|
+
|
|
7
|
+Just clone this repository, edit the `settings.json` file (described below) and run the server:
|
|
8
|
+
|
|
9
|
+```
|
|
10
|
+git clone https://github.com/babolivier/smam
|
|
11
|
+cd smam
|
|
12
|
+npm install
|
|
13
|
+npm start
|
|
14
|
+```
|
|
15
|
+
|
|
16
|
+The default port will be set to `1970`, but you can set the one you want by using an environment variable:
|
|
17
|
+
|
|
18
|
+```bash
|
|
19
|
+PORT=8080 npm start
|
|
20
|
+```
|
|
21
|
+
|
|
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).
|
|
23
|
+
|
|
24
|
+## Usage
|
|
25
|
+
|
|
26
|
+First, include the script in your HTML page's header:
|
|
27
|
+
|
|
28
|
+```html
|
|
29
|
+<head>
|
|
30
|
+ ...
|
|
31
|
+ <script src="http://www.example.tld:1970/form.js" charset="utf-8"></script>
|
|
32
|
+ ...
|
|
33
|
+</head>
|
|
34
|
+```
|
|
35
|
+
|
|
36
|
+Then, add an empty `<form>` tag to your page's body. It **must** have an ID. Now, pass this ID to the `generateForm()` function in a `<script>` block, as such:
|
|
37
|
+
|
|
38
|
+```html
|
|
39
|
+<body>
|
|
40
|
+ ...
|
|
41
|
+ <form id="smam"></form>
|
|
42
|
+ <script type="text/javascript">
|
|
43
|
+ generateForm('smam');
|
|
44
|
+ </script>
|
|
45
|
+ ...
|
|
46
|
+</body>
|
|
47
|
+```
|
|
48
|
+
|
|
49
|
+## Configuration
|
|
50
|
+
|
|
51
|
+First, you must rename the `settings.example.conf` into `settings.conf`, and edit it. You'll find yourself in front of a file with this structure:
|
|
52
|
+
|
|
53
|
+```json
|
|
54
|
+{
|
|
55
|
+ "mailserver": {
|
|
56
|
+ "pool": true,
|
|
57
|
+ "host": "mail.example.tld",
|
|
58
|
+ "port": 465,
|
|
59
|
+ "secure": true,
|
|
60
|
+ "auth": {
|
|
61
|
+ "user": "noreply@noreply.tld",
|
|
62
|
+ "pass": "hackme"
|
|
63
|
+ }
|
|
64
|
+ },
|
|
65
|
+ "recipients": [
|
|
66
|
+ "you@example.tld",
|
|
67
|
+ "someone.else@example.com"
|
|
68
|
+ ]
|
|
69
|
+}
|
|
70
|
+```
|
|
71
|
+
|
|
72
|
+The `mailserver` section is the set of parameters which will be passed to nodemailer's transporter initialisation, describing the output mail server and following the same structure as the `option` object in [nodemailer's SMTP configuration section](https://github.com/nodemailer/nodemailer#set-up-smtp). Please head there to have the full list of parameters.
|
|
73
|
+
|
|
74
|
+The `recipients` server is an array containing the e-mail addresses any message sent via the form will be sent to. Just write down the form's recipient(s)'s addresse(s).
|
|
75
|
+
|
|
76
|
+## Contribute
|
|
77
|
+
|
|
78
|
+If you like this project and want to help, there's many way to do it.
|
|
79
|
+
|
|
80
|
+- Suggest new features in an [issue](https://github.com/babolivier/smam/issues)
|
|
81
|
+- Report every bug or inconvenience you encountered during this software in the [issues](https://github.com/babolivier/smam/issues)
|
|
82
|
+- Pick up an [issue](https://github.com/babolivier/smam/issues) and fix it by submitting a [pull request](https://github.com/babolivier/smam/pulls)
|
|
83
|
+- Implement a new database driver
|
|
84
|
+- Start implementing a new feature you'd like to use in the software*
|
|
85
|
+
|
|
86
|
+\* Before you start implementing anything, please make sure to create an [issue](https://github.com/babolivier/smam/issues) about it if one hasn't been created yet. If I don't want to see your idea in SMAM (even if it's quite unlikely), it can be frustrating to you to have been working hard on someting for nothing.
|
|
87
|
+
|
|
88
|
+## Get in touch
|
|
89
|
+
|
|
90
|
+If you want to talk with me in person about SMAM, you can contact me in different ways:
|
|
91
|
+
|
|
92
|
+- Via Twitter at [@BrenAbolivier](https://twitter.com/BrenAbolivier)
|
|
93
|
+- Via IRC, I'm usually hanging out on [Freenode](https://freenode.net) as *babolivier*
|
|
94
|
+- Via e-mail, at <oss@brendanabolivier.com>
|