Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,41 @@ server.pack.register pluginConf, (err) ->

```

## Send Mail
## Send Mail Using Template
```Coffeescript

fnCallback = (err,result) ->
# Do some stuff when done.

plugin = server.pack.plugins['hapi-mandrill']
plugin = server.plugins['hapi-mandrill']

plugin.send("Angelina Jolie","angelina@jolie.com", {some: "payload"},"Hello Angelina","angelina-template", fnCallback)
```

## Send Mail without Template
```
fnCallback = (err,result) ->
# Do some stuff when done.

var plugin = server.plugins['hapi-mandrill'],
message = {
from_email: "from@domain.tld",
from_name: "Person From",
to: [
{
email: "to@domain.tld",
name: "Person To",
type: "to"
}
],
subject: "Email Subject",
text: "Email Text",
html: "<p>Email HTML</p>"
};


// See https://mandrillapp.com/api/docs/messages.JSON.html#method=send for full Message API definition
plugin.sendNoTemplate( message , fnCallback )
```

## Logging
Expand All @@ -59,12 +84,11 @@ key is not found it will be passed verbatim.

## Exposed Properties
```Coffeescript
plugin = server.pack.plugins['hapi-mandrill']
plugin = server.plugins['hapi-mandrill']

plugin.mandrillClient # Note this is null if you do not pass a key in options
plugin.send(...)
plugin.templateNameMapping = {...}

```

## See also
Expand Down
37 changes: 37 additions & 0 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "hapi-mandrill",
"description": "HAPI plugin that exposes mandrill api - used to send transactional emails.",
"version": "2.1.1",
"version": "2.1.2",
"private": false,
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/codedoctor/hapi-mandrill.git"
},
"engines": {
"node": "0.10.x"
"node": ">=0.10.x"
},
"scripts": {
"test": "node_modules/.bin/grunt testandcoverage"
Expand Down