Code Monkey home page Code Monkey logo

minimail's Introduction

Minimail sends emails. I use it to send notification emails to myself from scripts. /usr/bin/mail -s 'hi there' [email protected] can be called from a shell script as well, Minimail just wraps that. Minimail wraps command-line code with descriptive method and variable names and test code, to make maintenance easier. Minimail makes it easier to share this functionality between projects thanks to Rubygems and bundler.

Installation

With bundler

# gem install bundler
gem 'minimail'
bundle

Without bundler

require 'minimail'

Usage

# Send an email (one-liner)
Minimail::Mail.new(:subject => "check it!", :recipients => "[email protected]").deliver

# Or do the same with a DSL style
m = Minimail::Mail.new
m.draft do
  subject "check it!"
  recipients "[email protected]"
end
m.deliver

# Include an attachment
Minimail::Mail.new(:subject => "check this attachment", :recipients => "[email protected]", :attachments => File.join(Dir.pwd, 'test', 'fake_attachment.txt')).deliver

Run tests

# clone source, setup ruby and gemset (I use RVM). rvm use 1.8.7; rvm gemset create minimail; rvm gemset use minimail
# gem install bundler && bundle (make sure bundler "test" group gems are installed)
rake # as of this writing: 6 tests, 11 assertions, 0 failures, 0 errors, 0 skips

Debugging

Some ISPs will block the SMTP port or black-list IP addresses. I was not able to send on a Verizon ISP connection for home, but was able to send using my cellular 3G connection (also Verizon) while tethered.

The mail will also likely show up in the spam folder.

# on OS X tail the mail log file
tail -f /var/log/mail.log

Credits

Minimail was inspired by some code from Val Aleksenko. Thanks Val!

minimail's People

Stargazers

Thomas Olausson avatar

Watchers

Thomas Olausson avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.