Project

mailcrate

0.0
No commit activity in last 3 years
No release in over 3 years
A mock SMTP server that can be run and inspected from tests. The server runs in memory and received messages can be retrieved.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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