-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,51 @@ | ||
# ultrases [![Build Status](https://secure.travis-ci.org/ytanay/ultrases.png?branch=master)](http://travis-ci.org/ytanay/ultrases) | ||
|
||
Stupidly easy mailing with Amazon AWS SES (Simple Email Service) | ||
Dead simple email dispatch with AWS SES (Amazon Simple Email Service) with templates! | ||
|
||
## Getting Started | ||
Install the module with: `npm install ultrases` | ||
|
||
```javascript | ||
var UltraSES = require('ultrases'); | ||
var mailer = new UltraSES({...}); // "awesome" | ||
var mailer = new UltraSES({...}); | ||
``` | ||
|
||
## Documentation | ||
_(Coming soon)_ | ||
|
||
### Setup | ||
Start by creating a new instance of UltraSES. Pass your access key for AWS in this fashion: | ||
```javascript | ||
var mailer = new UltraSES({ | ||
aws: { | ||
accessKeyId: 'LOOKATHESEUPERCASELETTERANDNUMBERS123', | ||
secretAccessKey: 'shhhhits/asecret+42' | ||
} | ||
} | ||
``` | ||
You can also supply defaults for sending emails (for example, the "source" address) | ||
```javascript | ||
var mailer = new UltraSES({ | ||
aws: {...}, | ||
defaults: {from: 'Team Octocat <[email protected]>'} | ||
} | ||
``` | ||
You can always override these defaults when you send the actual emails, of course. | ||
### Sending a simple email | ||
The basic method for sending email is ```mailer.sendText(email, text, done)``` and it takes (as you can probably see), 3 arguments): | ||
```javascript | ||
mailer.sendText({to: '[email protected]', subject: 'Hello from Octoland!'}, 'Look at this fantastic email body!', function(err){ | ||
if(err) throw err; | ||
console.log('email sent!'); | ||
} | ||
``` | ||
Some notes: | ||
+ The emails will be sent from [email protected]__, because we set that as a default during initialization. | ||
+ You may include the message body in the "email" object instead of as an extra argument (i.e. ```{subject: '...', text: '..'}```) | ||
## Examples | ||
_(Coming soon)_ | ||
_(In a bit)_ | ||
## Contributing | ||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). | ||
|