Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including railway-mailer with all npm packages installed. Try it out:

var railwayMailer = require("railway-mailer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

railway-mailer v0.0.1

Railway extenstion for sending emails

Installation

mkdir node_modules
git clone https://github.com/1602/railway-mailer.git node_modules/mailer
echo "require('mailer');" >> npmfile.js
touch config/mailer.yml

Configure

In config/mailer.yml:

development:
  url: "http://localhost:3000"
  mailer: sendmail
  from: "noreply@localhost"
test:
  url: "http://localhost"
  mailer: test
  from: "noreply@example.com"
production:
  mailer: smtp
  url: "http://yoursitename.tld"
  from: "noreply@yoursitename.tld"
  host: localhost
  port: 25
  use_authentication: 0
  user: ""
  pass: ""

Usage

Put you email views into the app/views/emails directory with following naming style:

templatename.format (html or text)
templatename.locale.format

When you want to send email, just call

app.extensions.mailet.sendEmail(
    'templatename',
     data,
     {subject: 'Email subject', email: 'recipient@example.com', from: 'me@home'}
);

I know, this API is ugly :) better solution is coming soon.

License

MIT

Contribution

Contributors are welcome

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free