Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A mock SMTP server loosely based on mailtrap and greenmail
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
spec
.gitignore
Gemfile
Gemfile.lock
MIT.LICENSE
README.md
Rakefile
mailcrate.gemspec

README.md

Mailcrate

by Adam Scott http://adams.co.tt/

Description

A mock SMTP server loosely based on mailtrap and greenmail, and can be used for automated testing. Like mailtrap, mailcrate listens on a chosen port and talks just enough SMTP protocol for ActionMailer to successfully deliver a message. However, like greenmail, it is started, stopped and interogated from your test code.

Install

gem install mailcrate

Usage

The constructor requires a single parameter, the port which it should listen on.

require 'mailcrate'

mailcrate = Mailcrate.new(2525)
mailcrate.start

Mailer.send_mail(:to => 'to@example.com', :from => 'from@example.com', :body => 'An important message.')

mailcrate.mails[0][:from].should == 'from@example.com'
mailcrate.mails[0][:to_list].should include 'to@example.com'
mailcrate.mails[0][:body].should == 'An important message.'

mailcrate.stop

Status

Build Status

Something went wrong with that request. Please try again.