Railsware code repo for the JavaScript Email Validation article.
This repo demonstrates how to use NodeJS for validation, to batch, and send emails.
Check out the Railsware blog to learn several great ways to send emails using using handy client frameworks like React.js, Email.js, and Nodemailer.
Note: All credentials supplied are dummy credentials!
-
Email SDK's, frameworks, and tools:
-
Email attachment handling and batching via the above
-
Simple SMS Gateway helper for sending texts
Email and HTML template validation techniques are described in the article! Unit tests are also provided.
Sign up for these email-related accounts:
Step-by-step instructions to do so are provided in the article!
Configure settings in config.js!
Start it up:
npm i
npm run start
npm run tests
By default, the http server will serve from http://localhost:7777
Shut it down:
npm run stop-linux
nom run stop-win
Each email endpoint supports basic
, attachment
, batch
like so:
{
"email": "basic"
}
Note: A couple batch
endpoints are probably best served using a dedicated API through the automation provider - a response message is returned where this is the case.
To send an SMS text message via email you need three components:
- Send a basic email with text.
- A valid phone number.
- A valid carrier.
Supplied to create a more realistic example. Be forewarned:
- These are very brittle and have no error handling!
- Purely in-memory NoSQL!
{"status":200,"data":[{"id":0,"name":"J Everyperson","email":"[email protected]","telegram_id":"@coolperson"},{"id":1,"name":"Larry Dude","email":"[email protected]","telegram_id":"@dudeperson"},{"id":2,"name":"Ms. Ladyface","email":"[email protected]","telegram_id":"@ladyface"},{"id":3,"name":"J Nobody","email":"[email protected]","telegram_id":"@Nobody"},{"id":4,"name":"Frankenstein","email":"[email protected]","telegram_id":"@monster"},{"id":5,"name":"Rockstar","email":"[email protected]","telegram_id":"@toocool"},{"id":6,"name":"beep boop","email":"[email protected]","telegram_id":"@robutnik"},{"id":7,"name":"Crazy Cat","email":"[email protected]","telegram_id":"@meow"},{"id":8,"name":"The Red Devils","email":"[email protected]","telegram_id":"@marketgarden"},{"id":9,"name":"Jar Jar Binks","email":"[email protected]","telegram_id":"@whatamievensaying"}]}
{
"status": 200,
"data": {
"id": 0,
"name": "J Everyperson",
"email": "[email protected]",
"telegram_id": "@coolperson"
}
}
{
"contact": {
"id": 15,
"name": "New Man",
"email": "[email protected]",
"telegram_id": "@newman"
}
}
{
"status": 200,
"data": [
{
"id": 0,
"name": "J Everyperson",
"email": "[email protected]",
"telegram_id": "@coolperson"
},
{
"id": 1,
"name": "Larry Dude",
"email": "[email protected]",
"telegram_id": "@dudeperson"
},
{
"id": 2,
"name": "Ms. Ladyface",
"email": "[email protected]",
"telegram_id": "@ladyface"
},
{
"id": 3,
"name": "J Nobody",
"email": "[email protected]",
"telegram_id": "@Nobody"
},
{
"id": 4,
"name": "Frankenstein",
"email": "[email protected]",
"telegram_id": "@monster"
},
{
"id": 5,
"name": "Rockstar",
"email": "[email protected]",
"telegram_id": "@toocool"
},
{
"id": 6,
"name": "beep boop",
"email": "[email protected]",
"telegram_id": "@robutnik"
},
{
"id": 7,
"name": "Crazy Cat",
"email": "[email protected]",
"telegram_id": "@meow"
},
{
"id": 8,
"name": "The Red Devils",
"email": "[email protected]",
"telegram_id": "@marketgarden"
},
{
"id": 9,
"name": "Jar Jar Binks",
"email": "[email protected]",
"telegram_id": "@whatamievensaying"
},
null,
null,
null,
null,
null,
{
"id": 15,
"name": "New Man",
"email": "[email protected]",
"telegram_id": "@newman"
}
]
}
{
"contact": {
"id": 0,
"name": "Changed Man",
"email": "[email protected]",
"telegram_id": "@differentperson"
}
}
{
"status": 200,
"data": [
{
"id": 0,
"name": "Changed Man",
"email": "[email protected]",
"telegram_id": "@differentperson"
},
{
"id": 1,
"name": "Larry Dude",
"email": "[email protected]",
"telegram_id": "@dudeperson"
},
{
"id": 2,
"name": "Ms. Ladyface",
"email": "[email protected]",
"telegram_id": "@ladyface"
},
{
"id": 3,
"name": "J Nobody",
"email": "[email protected]",
"telegram_id": "@Nobody"
},
{
"id": 4,
"name": "Frankenstein",
"email": "[email protected]",
"telegram_id": "@monster"
},
{
"id": 5,
"name": "Rockstar",
"email": "[email protected]",
"telegram_id": "@toocool"
},
{
"id": 6,
"name": "beep boop",
"email": "[email protected]",
"telegram_id": "@robutnik"
},
{
"id": 7,
"name": "Crazy Cat",
"email": "[email protected]",
"telegram_id": "@meow"
},
{
"id": 8,
"name": "The Red Devils",
"email": "[email protected]",
"telegram_id": "@marketgarden"
},
{
"id": 9,
"name": "Jar Jar Binks",
"email": "[email protected]",
"telegram_id": "@whatamievensaying"
}
]
}
DELETE localhost:7777/api/?id=1
{
"status": 200,
"data": [
{
"id": 0,
"name": "J Everyperson",
"email": "[email protected]",
"telegram_id": "@coolperson"
},
null,
{
"id": 2,
"name": "Ms. Ladyface",
"email": "[email protected]",
"telegram_id": "@ladyface"
},
{
"id": 3,
"name": "J Nobody",
"email": "[email protected]",
"telegram_id": "@Nobody"
},
{
"id": 4,
"name": "Frankenstein",
"email": "[email protected]",
"telegram_id": "@monster"
},
{
"id": 5,
"name": "Rockstar",
"email": "[email protected]",
"telegram_id": "@toocool"
},
{
"id": 6,
"name": "beep boop",
"email": "[email protected]",
"telegram_id": "@robutnik"
},
{
"id": 7,
"name": "Crazy Cat",
"email": "[email protected]",
"telegram_id": "@meow"
},
{
"id": 8,
"name": "The Red Devils",
"email": "[email protected]",
"telegram_id": "@marketgarden"
},
{
"id": 9,
"name": "Jar Jar Binks",
"email": "[email protected]",
"telegram_id": "@whatamievensaying"
}
]
}