Simple mail server that slurps mail into oblivion!
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
admin
profiling
settings
smtp
www
.gitignore
LICENSE
README.md
config.json
mailslurper.go
screenshot.png
send-mail-test.py

README.md

This project is out of date. Please visit http://mailslurper.com to get to the latest version of MailSlurper.

MailSlurper-Go

Simple mail SMTP server that slurps mail into oblivion! Useful only for local development MailSlurper runs on port 8000 (though it can be changed) and listens for outgoing mail send requests. When one is received the mail item is stored in a local SQLite database.

To view the mail items that were slurped up you can open your web browser and go to the address http://localhost:8080 (note that this port can be changed too).

Requirements (to build)

How To Run MailSluper

Make sure you have the following:

  • An operating system (Windows, Linux, FreeBSD)
  • A modern browser (Chrome, Firefox)

Then download the latest release of MailSlurper. You can find releases at https://github.com/adampresley/mailslurper-go/releases. Extract the contents of the ZIP file to any location you like and then run the executable.

Windows

  • Open Explorer to where you extracted this contents of the ZIP file
  • Double-click on mailslurper.exe. This will open the console window
  • Open your favorite browser and browse to http://localhost:8080

Ubuntu

  • Open a terminal
  • Change directory to where you extract the ZIP file
    • cd /path/to/mailslurper
  • Execute the program
    • ./mailslurper
  • Open your favorite browser and browse to http://localhost:8080

How to Build

If you are more adventurous and wish to compile this yourself then this section is for you. Assuming you have Go installed on your system and your GOPATH environment variable setup, place this source code, the whole mailslurper folder, in $GOPATH/src/github.com/adampresley. Please note that the name of the folder must be mailslurper. Not mailslurper-go or anything else. For more information on setting up Google Go visit http://golang.org/doc/install.

Once you've done this open up a terminal and execute the following:

$ go get
$ go install github.com/adampresley/mailslurper

Executing the above will download and compile any dependencies and create an executable for your OS/platform into the $GOPATH/bin folder. Here you may want to create a folder somewhere easily accessible. Copy the following items to this new folder.

  • $GOPATH/bin/mailslurper (mailslurper.exe on Windows)
  • $GOPATH/src/github.com/adampresley/mailslurper/www
  • $GOPATH/src/github.com/adampresley/mailslurper/config.json

Additional Information

From a terminal:

  • Windows: mailslurper.exe
  • Linux: ./mailslurper

To see what options are available on the terminal execute the following:

$ ./mailslurper -help

The following options are available.

  • -smtpport - Port number to bind to for the SMTP server. Defaults to 8000
  • -smtpaddress - Address to bind the SMTP server to. Defaults to 127.0.0.1
  • -wwwport - Port number to bind to for the web-based administrator. Defaults to 8080
  • -www - Path to the web administrator directory. Defaults to www/

So, for example, to run MailSlurper on different ports, try this.

$ ./mailslurper -smtpport=2500 -wwwport=8083

Configuration

MailSlurper can be configured by providing settings in a file called config.json. This is a text-based file with a JSON structure in it containing four configuration settings. It looks like this.

{
	"www": "www/",
	"wwwPort": 8080,
	"smtpAddress": "127.0.0.1",
	"smtpPort": 8000,
	"dbEngine": "sqlite",
	"dbHost": "",
	"dbPort": "",
	"dbDatabase": "",
	"dbUserName": "",
	"dbPassword": ""
}
  • www - Path to the web administrator directory.
  • wwwPort - Port number to bind to for the web-based administrator.
  • smtpAddress - Address to bind the SMTP server to.
  • smtpPort - Port number to bind to for the SMTP server.
  • dbEngine - Storage engine to use. Options are sqlite, mysql, or mssql
  • dbHost - Server address for your database. Only applies to mysql and mssql
  • dbPort - Port your database runs on. Only applies to mysql and mssql
  • dbDatabase - Database name to store mail in. Only applies to mysql and mssql
  • dbUserName - User name to connect to your database with. Only applies to mysql and mssql
  • dbPassword - Password to connect to your database with. Only applies to mysql and mssql

Please note that these provide MailSlurper the settings it needs to run and the file must be configured properly for the application to function. Also note that if you provide command line flag settings when running the server these configuration values will be superceded by the command line flags.

Documentation

Wanna see the documentation? Open up a terminal and try the following (Linux. Windows will vary slightly).

$ cd $GOPATH
$ godoc -http=:6060

Then open up your favorite browser to http://localhost:6060 and you will see a Go page. Click on the button named Packages at the top, and you will be presented with a list of packages. Find github.com and under that you will find the path adampresley/mailslurper. The package documentation is all there.

Release Notes

2014-06-04

  • MailSlurper now supports storing mail and attachments in one of three engines:
    • SQlite
    • MySQL
    • Microsoft SQL Server 2008+

2014-06-02

  • Rewrote the mail header and body parsing routine.
  • Attachments are now parsed correctly, stored, and can be viewed from the interface
  • Body contents are no longer stored with the mail item row. They are retrieved on demain (when clicking on the row)
  • Added a favicon

2014-05-05

  • Mails that contain HTML or are multipart text and HTML now display HTML in the viewer
  • Added ability to search the subject and bodies of mails to filter mail list
  • Added sorting of mail items
  • Addressed a date parsing issue with mails that have the timezone wrapped in parentheses
  • Addressed browser resize issue. Layout now is resizable and more responsive
  • Removed unneeded code
  • Updated several libraries

2013-12-15

  • Added new interface to the administrator to change settings to config.json
  • Some code cleanup

2013-12-12

  • Options can now be configured through settings in a file named config.json

2013-12-11

  • New command line flag -smtpaddress allows you to specify address to bind the SMTP server to

2013-12-06

  • Mails now display in descending order
  • SMTP server now writes new mail items to a websocket to update the UI
  • Updated version to 1.1

2013-12-04

  • Initial conversion of the Groovy+Grails version of MailSlurper to Google Go. It is still pretty rough, but the mechanics are there

Copyright Information

Mailslurper makes use of many libraries and tools. They are copyright of their respective owners.

  • jQuery - Copyright 2014 The jQuery Foundation
  • jQuery UI - Copyright 2014 The jQuery Foundation
  • Ractive - Copyright 2012-2014 Rich Harris
  • Bootstrap - Copyright 2014 Twitter
  • RequireJS - Copyright 2010-2013, The Dojo Foundation
  • jQuery BlockUI - Copyright 2007-2009 M. Alsup
  • jQuery UI Layout - Copyright 2013 Kevin Dalman
  • Moment.js - Copyright 2011-2014 Tim Wood, Iskren Chernev, Moment.js contributors
  • Google Go - Copyright 2012 The Go Authors
  • go-sqlite3 - Copyright 2012-2014 Yasuhiro Matsumoto
  • go-mssqldb - Copyright 2012 The Go Authors (https://github.com/denisenkom/go-mssqldb)
  • Go-MySQL-Driver - Copyright ? (https://github.com/go-sql-driver/mysql)
  • Gorilla Web Toolkit - Copyright 2012 Rodrigo Moraes
  • MailSlurper logo uses:
    • Go gopher - Created by and copyright Renee French
    • Mail icon copyright David Hopkins, http://semlabs.co.uk

License

The MIT License (MIT) Copyright (c) 2013-2014 Adam Presley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.