Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add check for missing sender environment variable, other minor tweaks

  • Loading branch information...
commit 7116d7454159bfb14d19edb08c000e4c08a9c18e 1 parent c84029a
@DukeyToo DukeyToo authored
Showing with 7 additions and 5 deletions.
  1. +3 −1 lib/main.js
  2. +2 −2 package.json
  3. +2 −2 readme.md
View
4 lib/main.js
@@ -4,6 +4,8 @@ var path = require('path');
exports.send = send = function(config, callback) {
+ if (!config.environment.EMAIL_SENDER) return callback('environment variable EMAIL_SENDER is required.');
+
var formData = config.formData;
if (!formData) return callback('no form-data found');
if (!formData.length) return callback('form data should be an array');
@@ -51,7 +53,7 @@ exports.send = send = function(config, callback) {
}
mailer.send_mail(options, function(err, success) {
- if (err) return callback(err);
+ if (err) { console.error(err); return callback(err);}
if (success !== true) return callback("unexpected error sending email: " + success);
//really should not wait as this introduces a delay, but it is ok at low volumes
View
4 package.json
@@ -1,9 +1,9 @@
{ "name": "signup"
, "preferGlobal": "true"
, "version": "0.0.2"
- ,"description": "A simple servie API that can be used to handle website forms, like signups and contact forms"
+ ,"description": "A simple service API that can be used to handle website forms, like signups and contact forms"
, "author": {"name": "Steve Campbell", "email": "steve@perfectapi.com" }
- ,"keywords": "signup, contact, form, webform, api"
+ ,"keywords": "signup, contact, form, webform, api, perfectapi"
,"homepage": "http://www.perfectapi.com/"
,"bugs": {"url": "https://github.com/perfectapi/signup/issues", "email": "signup@perfectapi.com" }
,"main": "./lib/signup.js"
View
4 readme.md
@@ -24,7 +24,7 @@ For other commands, try:
## Configuring SMTP and email templates
-The API has a `templates` folder with various predefined JSON and TXT files. When installed globally, this is usually `/usr/local/lib/node_modules/signup/templates` or `C:\Program Files (x86)\nodejs\node_modules\signup\templates`.
+The API has a `templates` folder with various predefined JSON and TXT files. When installed globally, this is usually `/usr/local/lib/node_modules/signup/templates` or on Windows `%APPDATA%\npm\node_modules\signup\templates`.
The JSON files are configs for SMTP and the TXT files are email templates. You should copy or rename *one* of the SMTP files into `settings.json`. Edit the file to input your own SMTP settings. You can also create one or more email templates, or just edit the default `email.txt` template.
@@ -41,7 +41,7 @@ On your web page with some sort of form, you need to have a link to jQuery, and
<script type="text/javascript" src="http://localhost:3000/signup/jquery.perfectapi.js" ></script>
```
-This is an example of HTML and client-side javascript for a signup form, using jQuery.validate for the client-side validation:
+This is an example of HTML and client-side javascript for a signup form, using jQuery.validate for the client-side validation. Email address of the person filling out the form **must** be in a field with id of `email`.
```
<form id="signupForm" class="signupform">

0 comments on commit 7116d74

Please sign in to comment.
Something went wrong with that request. Please try again.