Giter Site home page Giter Site logo

sj26 / mailcatcher Goto Github PK

View Code? Open in Web Editor NEW
6.2K 80.0 571.0 948 KB

Catches mail and serves it through a dream.

Home Page: http://mailcatcher.me

License: MIT License

Ruby 67.26% CoffeeScript 18.34% HTML 3.81% Dockerfile 0.97% Sass 9.62%
smtp mail server ruby rails rubygems development devtools

mailcatcher's Introduction

MailCatcher

Catches mail and serves it through a dream.

MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that's arrived so far.

MailCatcher screenshot

Features

  • Catches all mail and stores it for display.
  • Shows HTML, Plain Text and Source version of messages, as applicable.
  • Rewrites HTML enabling display of embedded, inline images/etc and opens links in a new window.
  • Lists attachments and allows separate downloading of parts.
  • Download original email to view in your native mail client(s).
  • Command line options to override the default SMTP/HTTP IP and port settings.
  • Mail appears instantly if your browser supports WebSockets, otherwise updates every thirty seconds.
  • Runs as a daemon in the background, optionally in foreground.
  • Sendmail-analogue command, catchmail, makes using mailcatcher from PHP a lot easier.
  • Keyboard navigation between messages

How

  1. gem install mailcatcher
  2. mailcatcher
  3. Go to http://127.0.0.1:1080/
  4. Send mail through smtp://127.0.0.1:1025

Command Line Options

Use mailcatcher --help to see the command line options.

Usage: mailcatcher [options]

MailCatcher v0.8.0

        --ip IP                      Set the ip address of both servers
        --smtp-ip IP                 Set the ip address of the smtp server
        --smtp-port PORT             Set the port of the smtp server
        --http-ip IP                 Set the ip address of the http server
        --http-port PORT             Set the port address of the http server
        --messages-limit COUNT       Only keep up to COUNT most recent messages
        --http-path PATH             Add a prefix to all HTTP paths
        --no-quit                    Don't allow quitting the process
    -f, --foreground                 Run in the foreground
    -b, --browse                     Open web browser
    -v, --verbose                    Be more verbose
    -h, --help                       Display this help information
        --version                    Display the current version

Upgrading

Upgrading works the same as installation:

gem install mailcatcher

Ruby

If you have trouble with the setup commands, make sure you have Ruby installed:

ruby -v
gem environment

You might need to install build tools for some of the gem dependencies. On Debian or Ubuntu, apt install build-essential. On macOS, xcode-select --install.

If you encounter issues installing thin, try:

gem install thin -v 1.5.1 -- --with-cflags="-Wno-error=implicit-function-declaration"

Bundler

Please don't put mailcatcher into your Gemfile. It will conflict with your application's gems at some point.

Instead, pop a note in your README stating you use mailcatcher, and to run gem install mailcatcher then mailcatcher to get started.

RVM

Under RVM your mailcatcher command may only be available under the ruby you install mailcatcher into. To prevent this, and to prevent gem conflicts, install mailcatcher into a dedicated gemset with a wrapper script:

rvm default@mailcatcher --create do gem install mailcatcher
ln -s "$(rvm default@mailcatcher do rvm wrapper show mailcatcher)" "$rvm_bin_path/"

Rails

To set up your rails app, I recommend adding this to your environments/development.rb:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => '127.0.0.1', :port => 1025 }
config.action_mailer.raise_delivery_errors = false

PHP

For projects using PHP, or PHP frameworks and application platforms like Drupal, you can set PHP's mail configuration in your php.ini to send via MailCatcher with:

sendmail_path = /usr/bin/env catchmail -f [email protected]

You can do this in your Apache configuration like so:

php_admin_value sendmail_path "/usr/bin/env catchmail -f [email protected]"

If you've installed via RVM this probably won't work unless you've manually added your RVM bin paths to your system environment's PATH. In that case, run which catchmail and put that path into the sendmail_path directive above instead of /usr/bin/env catchmail.

If starting mailcatcher on alternative SMTP IP and/or port with parameters like --smtp-ip 192.168.0.1 --smtp-port 10025, add the same parameters to your catchmail command:

sendmail_path = /usr/bin/env catchmail --smtp-ip 192.160.0.1 --smtp-port 10025 -f [email protected]

Django

For use in Django, add the following configuration to your projects' settings.py

if DEBUG:
    EMAIL_HOST = '127.0.0.1'
    EMAIL_HOST_USER = ''
    EMAIL_HOST_PASSWORD = ''
    EMAIL_PORT = 1025
    EMAIL_USE_TLS = False

Docker

There is a Docker image available on Docker Hub:

$ docker run -p 1080 -p 1025 sj26/mailcatcher
Unable to find image 'sj26/mailcatcher:latest' locally
latest: Pulling from sj26/mailcatcher
8c6d1654570f: Already exists
f5649d186f41: Already exists
b850834ea1df: Already exists
d6ac1a07fd46: Pull complete
b609298bc3c9: Pull complete
ab05825ece51: Pull complete
Digest: sha256:b17c45de08a0a82b012d90d4bd048620952c475f5655c61eef373318de6c0855
Status: Downloaded newer image for sj26/mailcatcher:latest
Starting MailCatcher v0.9.0
==> smtp://0.0.0.0:1025
==> http://0.0.0.0:1080

How those ports appear and can be accessed may vary based on your Docker configuration. For example, your may need to use http://127.0.0.1:1080 etc instead of the listed address. But MailCatcher will run and listen to those ports on all IPs it can from within the Docker container.

API

A fairly RESTful URL schema means you can download a list of messages in JSON from /messages, each message's metadata with /messages/:id.json, and then the pertinent parts with /messages/:id.html and /messages/:id.plain for the default HTML and plain text version, /messages/:id/parts/:cid for individual attachments by CID, or the whole message with /messages/:id.source.

Caveats

  • Mail processing is fairly basic but easily modified. If something doesn't work for you, fork and fix it or file an issue and let me know. Include the whole message you're having problems with.
  • Encodings are difficult. MailCatcher does not completely support utf-8 straight over the wire, you must use a mail library which encodes things properly based on SMTP server capabilities.

Thanks

MailCatcher is just a mishmash of other people's hard work. Thank you so much to the people who have built the wonderful guts on which this project relies.

Donations

I work on MailCatcher mostly in my own spare time. If you've found Mailcatcher useful and would like to help feed me and fund continued development and new features, please donate via PayPal. If you'd like a specific feature added to MailCatcher and are willing to pay for it, please email me.

License

Copyright © 2010-2019 Samuel Cochran ([email protected]). Released under the MIT License, see LICENSE for details.

mailcatcher's People

Contributors

ahmedgagan avatar boffbowsh avatar captbaritone avatar clockwerx avatar cobbr2 avatar csiszarattila avatar davad avatar dirkkelly avatar duncan3dc avatar ferdy89 avatar hdabrows avatar igneus avatar jacobh avatar jjoos avatar joshmcarthur avatar kimptoc avatar kulesa avatar lime avatar marcmillien avatar mtsmfm avatar ohbarye avatar olleolleolle avatar orhantoy avatar sandersch avatar schmidt avatar scudelletti avatar sj26 avatar tagliala avatar tonymtz avatar toy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mailcatcher's Issues

Net::SMTPFatalError (550 Message rejected)

I'm having an issue on my machine that my other developers aren't getting with the exact same code base. When sending via smtp in Rails and using mail catcher I'm getting 550s. The mail does show up in mailcatcher, however, it looks like a mime attachment instead of an html message.

$ mailcatcher -f -v                                                                                                                                                                                                                                           Starting MailCatcher                                                                                                                                                                                                                                          ==> smtp://127.0.0.1:1025                                                                                                                                                                                                                                     ==> http://127.0.0.1:1080                                                                                                                                                                                                                                     *** Error receiving message: {:sender=>"<[email protected]>", :recipients=>["<m                                                                                                                                                                              [email protected]>"], :source=>""}                                                                                                                                                                                                                                        Exception: undefined method `match' for nil:NilClass                                                                                                                                                                                                          Backtrace:                                                                                                                                                                                                                                                       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mail-2.4.4/lib/mail/utilities.rb:104:in `unbracket'                                                                                                                                  
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mail-2.4.4/lib/mail/part.rb:29:in `cid'                                                                                                                                              
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:51:in `block in add_message'                                                                                                             
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `each'                                                                                                                             
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `add_message'                                                                                                                      
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/lib/mail_catcher/smtp.rb:45:in `receive_message'                                                                                                                  
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:532:in `process_data_line'                                                                                                         
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:196:in `receive_line'                                                                                                              
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:64:in `receive_data'                                                                                                                
       /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'                                                                                                                                     /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'                                                                                                                                             /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/lib/mail_catcher.rb:134:in `run!'                                                                                                                                            /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/gems/mailcatcher-0.5.10/bin/mailcatcher:4:in `<top (required)>'                                                                                                                                      /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/bin/mailcatcher:19:in `load'                                                                                                                                                                         /Users/matt/.rvm/gems/ruby-1.9.3-p194@merchant_messaging/bin/mailcatcher:19:in `<main>'               

.

"Illegal option -s" when starting MailCatcher

When starting MailCatcher on Ubuntu, the following error is displayed:

Illegal option -s
Usage: /usr/bin/which [-a] args

I believe this is because you're trying to use a BSD specific argument, which throws an error on GNU which. It appears they had the same issue with Homebrew - Homebrew/legacy-homebrew#8801

I think the end solution was to implement this - https://github.com/adamv/homebrew/commit/dd280b935c3db50770f58de89029ce6ff6f28218 - so perhaps a similar method is required in MailCatcher?

mailcatcher Command Fails in Automator with Growl flag

I know this may not be directly related to the Mailcatcher code itself, but I'm having a hard time creating an Automator action that works correctly. Here are my inputs, both of which work perfectly from Terminal:

  1. mailcatcher --smtp-ip 10.37.129.2
  2. mailcatcher --smtp-ip 10.37.129.2 --growl

If I use Command number 1 in Automator, and then open up Safari to 127.0.0.1:1080, it works perfectly. I get the following output to the results window:

Starting MailCatcher
==> smtp://10.37.129.2:1025
==> http://127.0.0.1:1080
*** MailCatcher now runs as a daemon by default. Go to the web interface to quit.

If I add the --growl flag in command 2 and run the Automator workflow, Automator tells me The action "Run Shell Script" encountered an error, but it doesn't tell me where the error is, and there are no results returned from the script.

Can anyone else reproduce this issue in Automator? Automator Workflow Screenshot

Errors viewing messages

I assume this is a gem conflict somewhere, sorry about the screenshot however the copy + paste into a gist was pretty hard to read too:

Stacktrace (kinda)

NoMethodError at /messages/1.html undefined method gsub!' for nil:NilClass`

Sintra Error

gem 'rails', '3.2.1'
gem "sinatra", "~> 1.3.3"

Firefox can't establish connection to the server

It's bit weird but when I open MailCatcher with Firefox the polling is not working.
I get the following error in Firebug:

Firefox can't establish a connection to the server at ws://localhost:1080/messages.

What is weirder is that it works when I do the same thing in the Firebug console...

Just so you know, I'm using Firefox v11.0 on OS X. It was working before so I guess it's related to something that changed in ff...

Getting an error trying to run on Windows with Ruby 1.8.7

Getting the following error when trying to use the latest version (0.4.0) however version 0.3.2 starts up and runs just fine. This is on Windows 7 using Ruby 1.8.7.

C:\Program Files\Console2>mailcatcher
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** MailCatcher now runs as a daemon by default. Go to the web interface to quit.
C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/process/daemon.rb:3:in `fork':
fork() function is unimplemented on this machine (NotImplementedError)
        from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.7/lib/active_support/core_ext/process/daemon.rb:3:in `daemon'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mailcatcher-0.4.0/lib/mail_catcher.rb:95:in `run!'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `call'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `each'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mailcatcher-0.4.0/lib/mail_catcher.rb:75:in `run!'
        from C:/Ruby187/lib/ruby/gems/1.8/gems/mailcatcher-0.4.0/bin/mailcatcher:4
        from C:/Ruby187/bin/mailcatcher:19:in `load'
        from C:/Ruby187/bin/mailcatcher:19

Is there something I need to do to get the latest version to run on my setup?

Cucumber integration?

I'd love to be able to view a message that was sent through my test suite via rSpec or Cucumber. I can't seem to get it to work by using the same settings from config/env/development.rb as test.rb. Things work fine in development mode.

I also have config.action_mailer.perform_deliveries = true in my test.rb but to no avail.

Thanks,
Jon

Deletion fails

==> SMTP: Received message from '<[email protected]> size=432' (427 bytes)
SQLite3::SQLException - SQL logic error or missing database:
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:67:in `step'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.7/lib/sqlite3/statement.rb:67:in `execute'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/mailcatcher-0.5.11/lib/mail_catcher/mail.rb:157:in `delete_message!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/mailcatcher-0.5.11/lib/mail_catcher/web.rb:138:in `block in <class:Web>'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `block in compile!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `[]'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (2 levels) in route!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:981:in `block in process_route'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `catch'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `process_route'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:943:in `block in route!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `each'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `route!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1053:in `block in dispatch!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1050:in `dispatch!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `block in call!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `call!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/showexceptions.rb:21:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:172:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1947:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `block in call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1693:in `synchronize'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `call'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/connection.rb:54:in `process'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/mailcatcher-0.5.11/lib/mail_catcher.rb:134:in `run!'
        /root/mailcatcher/lib/ruby/gems/2.0.0/gems/mailcatcher-0.5.11/bin/mailcatcher:4:in `<top (required)>'
        ./bin/mailcatcher:23:in `load'
        ./bin/mailcatcher:23:in `<main>'

It's running on the current "stable" ruby version built from source. This is the mail in case it matters:

Content-Type: text/plain; charset="utf-8"
From: ***
To: ***
Subject: New meeting in indico (242075)
Date: Fri, 26 Apr 2013 10:24:07 +0200


_Category_
TEST Category
_Title_
does it work?
_Speaker/Chair_

_Room_

_Description_

_Creator_
MÖNNICH, Adrian (42604)
_Date_
2013-04-26 08:00:00+02:00 -> 2013-04-26 18:00:00+02:00
_Access_
https://********/conferenceDisplay.py?confId=242075

favicon gone?

No big deal, but just noticed there is no favicon on the :1080 interface :)

Clear

It would be nice if caught email could be expunged in the web interface, saving clutter.

error when starting mailcatcher (gem_original_require': no such file to load -- tilt (LoadError))

$ mailcatcher --version
Invalid gemspec in [/var/lib/gems/1.8/specifications/skinny-0.2.0.gemspec]: invalid date format in specification: "2010-11-01 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Illegal option -s
Usage: /usr/bin/which [-a] args
mailcatcher 0.5.5
$ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
$ gem --version
Invalid gemspec in [/var/lib/gems/1.8/specifications/skinny-0.2.0.gemspec]: invalid date format in specification: "2010-11-01 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
1.7.2

Persistence

It would be nice if MailCatcher had the option of persisting messages between restarts.

Date Parsing in Chrome

(possibly happens in other browsers, will follow up with more testing)

In chrome the date column was displaying 7th August for a mail that was delivered 7th of July.. screenshot coming when i do more testing and check other browsers. May fork it and patch issue myself.

Websocket handshake issue

Not sure if this is specific to mailcatcher or more of a chrome issue, but on the latest version of chrome, I am now receiving a websocket exception that prevents the background polling of new emails (in the UI) from working. This is the exception from the javascript console:

Error during WebSocket handshake: Sec-WebSocket-Protocol mismatch

I'm using Chrome 20.0.1132.57

Sendmail -f option

Hi,

I'm using mailcatcher for Drupal 7 development, and it works great, but I had to do a bit of tweaking before using it. Drupal 7 uses, by default, the -f option when sending an email. However, the -f option is not accepted by catchmail, which therefore generates an error.

If it's possible, it would be great to add a fake -f option to catchmail. Here is what I added, in the bin/catchmail file:
parser.on('-f FROM', 'Set the from address') do |from|

end

bundler downgrades mailcatcher after eventmachine upgrade

current dependence is eventmachine (~> 0.12) the new eventmachine version is 1.0. So it downgrades to mailcatcher (0.2.4) since it didn't specify eventmachine version. Current workaround is to lock the version number for mailcatcher in your Gemfile. But it will then use the older eventmachine

Can't Run Mailcatcher on Windows

using Ruby v.1.9.3

D:\dev\uni\www\oh-itu\nodeapp>gem install mailcatcher
Fetching: eventmachine-1.0.0-x86-mingw32.gem (100%)
Fetching: daemons-1.1.9.gem (100%)
Fetching: thin-1.4.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Fetching: skinny-0.2.2.gem (100%)
Fetching: mailcatcher-0.5.9.gem (100%)
Successfully installed eventmachine-1.0.0-x86-mingw32
Successfully installed daemons-1.1.9
Successfully installed thin-1.4.1
Successfully installed skinny-0.2.2
Successfully installed mailcatcher-0.5.9
5 gems installed
Installing ri documentation for eventmachine-1.0.0-x86-mingw32...
Installing ri documentation for daemons-1.1.9...
Installing ri documentation for thin-1.4.1...
Installing ri documentation for skinny-0.2.2...
Installing ri documentation for mailcatcher-0.5.9...
Installing RDoc documentation for eventmachine-1.0.0-x86-mingw32...
Installing RDoc documentation for daemons-1.1.9...
Installing RDoc documentation for thin-1.4.1...
Installing RDoc documentation for skinny-0.2.2...
Installing RDoc documentation for mailcatcher-0.5.9...

D:\dev\uni\www\oh-itu\nodeapp>mailcatcher
D:/inst/rails/Ruby1.9.3/lib/ruby/1.9.1/open3.rb:202:in `spawn': No such file or
directory - which (Errno::ENOENT)
        from D:/inst/rails/Ruby1.9.3/lib/ruby/1.9.1/open3.rb:202:in `popen_run'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/1.9.1/open3.rb:90:in `popen3'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/
lib/mail_catcher.rb:12:in `which'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/
lib/mail_catcher.rb:30:in `growlnotify?'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/
lib/mail_catcher.rb:56:in `<module:MailCatcher>'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/
lib/mail_catcher.rb:10:in `<top (required)>'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_re
quire.rb:36:in `require'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_re
quire.rb:36:in `require'
        from D:/inst/rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/
bin/mailcatcher:3:in `<top (required)>'
        from D:/inst/rails/Ruby1.9.3/bin/mailcatcher:19:in `load'
        from D:/inst/rails/Ruby1.9.3/bin/mailcatcher:19:in `<main>'

any suggestion? Thanks in advance

Sync STDOUT

When running with foreman, the output doesn't appear until I stop foreman because it's buffered. Is there currently a way to set STDOUT.sync = true? Could an option be added to do so? Thanks!

Instructions for running under supervisord

I'm not sure if this is a mailcatcher issue, but adding instructions for running mailcatcher under supervisord would be helpful. I couldn't get it working due to gemfile issues, the log says:

Could not locate Gemfile

I have the following in my supervisord.conf

command=/var/lib/jenkins/.rvm/bin/app_bundle exec catchmail

after running:

rvm gemset create mailcatcher
rvm gemset install mailcatcher mailcatcher

remove dependency on haml for rails 3.2.3

according to rails/rails#393
and https://github.com/haml/haml/blob/master/lib/haml/helpers/rails_323_textarea_fix.rb

I use slim with rails 3.2.3 in one of my company's projects, and in development env, I use mailcatcher.
So it will cause issue even I didn't use HAML on my project.

One solution is update HAML to 3.1.6.rc.1
but I think that will cause conflict if someone need an older version of HAML.

So it seems that remove the dependency on HAML is a good solution. as there's only one view file views/index.haml.

Refreshing mailcatcher

When refreshing the web interface

root@staging:/home/ubuntu# mailcatcher --ip 10.0.2.15 -f
Starting MailCatcher
==> smtp://10.0.2.15:1025
==> http://10.0.2.15:1080
/usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:1441:in `event_callback': undefined method `close' for 11:Fixnum (NoMethodError)
        from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
        from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/lib/mail_catcher.rb:134:in `run!'
        from /usr/local/lib/ruby/gems/1.9.1/gems/mailcatcher-0.5.9/bin/mailcatcher:4:in `<top (required)>'
        from /usr/local/bin/mailcatcher:19:in `load'
        from /usr/local/bin/mailcatcher:19:in `<main>'
root@staging:/home/ubuntu# 
root@staging:/home/ubuntu# gem list | grep mailcatcher
mailcatcher (0.5.9)
root@staging:/home/ubuntu# 

Proxy via nginx

For those looking to expose using nginx, you can try this config

upstream mailcatch {
   server 127.0.0.1:8025;
}

server {
   limit_conn  gulag 10;
   listen      <my ip>:80;
   server_name <FQDN>;
   root /usr/lib/ruby/gems/1.8/gems/mailcatcher-0.5.10/public;

   location / {
     try_files $uri @dynamic;
   }

   location @dynamic {
     proxy_pass http://mailcatch;
   }
}

Mailcatcher started using mailcatcher --smtp-ip 127.0.0.1 --smtp-port 1025 --http-ip 0.0.0.0 --http-port 8025

Send Email through Mailcatcher from external host

Would be great to be able to send email from an external host. For example, I work on a mac with a Windows Server running in Parallels. I'd like to be able to send email via smtp://10.37.129.2:1025.

This would allow me to view my email spool on the mac side of things while the windows server sits in the background. I use MockSMTP to do this currently, but it's development has stalled, and I can't get support for issues related to the app.

`event_callback`: undefined method `close' for 9:Fixnum (NoMethodError)

Here's what I'm doing:

  1. Start mailcatcher on the command line via mailcatcher
  2. Visit http://localhost:1080
  3. Page loads, but server crashes with this error:
redtail git:master ❯ mailcatcher                                                                                                                             ⏎
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
/Users/evan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:1441:in `event_callback': undefined method `close' for 9:Fixnum (NoMethodError)
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/mailcatcher-0.2.4/lib/mail_catcher.rb:21:in `run'
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/lib/ruby/gems/1.9.1/gems/mailcatcher-0.2.4/bin/mailcatcher:44:in `<top (required)>'
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/bin/mailcatcher:23:in `load'
    from /Users/evan/.rbenv/versions/1.9.3-p194-perf/bin/mailcatcher:23:in `<main>'

What gives?

Delivery

It would be nice if MailCatcher could on-send captured messages to their intended recipients, or a separately provided recipient.

Installation instructions outdated

Using the latest rvm for these,
rvm default@mailcatcher --create gem install mailcatcher
rvm wrapper default@mailcatcher --no-prefix mailcatcher catchmail

I get the following error:

Please note that `rvm gem ...` was removed, try `gem install mailcatcher` or `rvm all do gem install mailcatcher` instead. ( see: 'rvm usage' )

Time stamp on web display

The time stamp of mail it traps seems to be being displayed in UTC (or GMT), is there someway to change this to localize it to our time zone?

Otherwise it's a great product!

Smtp receiver should de-dup dots at beginning of a line

I'm not 100% certain, but it seems that according to rfc 821

http://tools.ietf.org/html/rfc821#page-41

the smtp receiving server should de-dup dots at the beginning of lines. This currently does not seem to be the case.

As a result, urls that wraps line in a mime message could end up with double dots and thus won't render properly.

For instance something like:

                        <img alt=3D"Orange_dog" src=3D"https://s3.amazonaws=
..com/attachments/image.png"/>

in the message will yield an invalid url in the browser when viewed in mailcatcher.

`popen': wrong number of arguments (3 for 2)

In version 0.5.7 I've got following error

→ mailcatcher
/home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/gems/mailcatcher-0.5.7/lib/mail_catcher.rb:19:in `popen': wrong number of arguments (3 for 2) (ArgumentError)
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/gems/mailcatcher-0.5.7/lib/mail_catcher.rb:19:in `which'
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/gems/mailcatcher-0.5.7/lib/mail_catcher.rb:35:in `growlnotify?'
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/gems/mailcatcher-0.5.7/lib/mail_catcher.rb:61
    from /home/ck3g/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
    from /home/ck3g/.rvm/rubies/ree-1.8.7-2012.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/gems/mailcatcher-0.5.7/bin/mailcatcher:3
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/bin/mailcatcher:19:in `load'
    from /home/ck3g/.rvm/gems/ree-1.8.7-2012.02@24h/bin/mailcatcher:19

20b5635

There is no errors in version 0.5.6

Mailcatcher crashing

I noticed that mailcatcher was crashing reasonably frequently.

Ran it in the foreground with verbose output and got this:

Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
==> SMTP: Received message from '<[email protected]>' (1232 bytes)
==> SMTP: Received message from '<[email protected]>' (1101 bytes)
==> SMTP: Received message from '<[email protected]>' (1098 bytes)
==> SMTP: Received message from '<[email protected]>' (1103 bytes)
/home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/gems/eventmachine-1.0.0/lib/eventmachine.rb:1441:in `event_callback': undefined method `close' for 15:Fixnum (NoMethodError)
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/gems/mailcatcher-0.5.9/lib/mail_catcher.rb:134:in `run!'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/gems/mailcatcher-0.5.9/bin/mailcatcher:4:in `<top (required)>'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/bin/mailcatcher:19:in `load'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/bin/mailcatcher:19:in `<main>'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/thomasfedb/.rvm/gems/ruby-1.9.3-p0@synaptor-observations/bin/ruby_noexec_wrapper:14:in `<main>'

Exception: SQL logic error or missing database

I am having a problem with mailcatcher on CentOS 5.8 with ruby 1.9.2-p180. Mailcatcher starts and binds to ports without issue. The first email I send is captured correctly and if I visit the web interface I can see that email. However, any subsequent emails are lost and do not show up in the web interface.

If I run mailcatcher in the foreground, I get the following error message: https://gist.github.com/2961398, which seems to point to a problem with sqlite.

Please let me know what else i can do to help you debug this issue.

Change Default HTTP IP?

I'm curious if it would cause a problem to change the default http ip to '0.0.0.0' ? It should still work the same and it would them work out of the box for people like me who develop in headless vagrant virtual machines and need to forward the port.

I'd be happy to do the pull request if you like.

I love the gem by the way.

MailCatcher 0.5.9 requires Skinny 0.2.2

Since solving #54 Gem dependencies aren't resolved properly:

/opt/ruby/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1615:in 'raise_if_conflicts':
Unable to activate skinny-0.2.1, because eventmachine-1.0.0 conflicts with eventmachine (~> 0.12) (Gem::LoadError)

Please set the version dependency in mailcatcher.gemspec:

--- a/mailcatcher.gemspec
+++ b/mailcatcher.gemspec
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
   s.add_dependency "sinatra", "~> 1.2"
   s.add_dependency "sqlite3", "~> 1.3"
   s.add_dependency "thin"
-  s.add_dependency "skinny"
+  s.add_dependency "skinny", "~> 0.2.2"

Maybe "thin" version should also be defined.

Support for CC, BCC

I'd love to see support for CC and BCC. I'm just now picking up a little Ruby, so I'm going to try forking the project to see if it's something I could put together myself, but I figured I'd post it as an issue in case someone gets to it before I do :).

Linked format tabs

Having the actual HREFs filled for format tabs would make opening HTML in a new window or tab easy.

"Download" link doesn't work in Chromium 14.0.783.0 (87587)

If you click the "Download" link for a message in Chromium, you just get a # added to your URL. The debugger doesn't indicate a Javascript error.

I can take a look at this (since I'm the one using a silly nightly browser) if it works in other browsers, but I wasn't sure if maybe it was an unimplemented feature.

Dependency issue while trying to install mailcatcher 0.5.8

Dependency issue while trying to install mailcatcher 0.5.8

..
Unable to activate skinny-0.2.2, because eventmachine-0.12.6 conflicts with eventmachine (~> 1.0) (Gem::LoadError)
..

0.5.8 does not work with skinny-0.2.2, only skinny-0.2.1

Dependency on thin makes running on JRuby impossible

The dependency on thin makes it impossible to run mailcatcher on JRuby.

Would it be a good approach to avoid being dependent on any specific server, perhaps picking from a few options at runtime? Or maybe just using a pure Ruby equivalent, such as Webrick?

Shutdown

GIven MailCatcher can now be run as a daemon, it would be nice if MailCatcher could be shut down from within the web interface.

Run multiple instances

I had a quick look at the code, but I'm not really a Ruby man so I might be wrong, but it looks like it isn't possible to run multiple instances (unless I duplicate the directory). I would be nice if I could specify an instance id on the command line so I could run multiple instances side by side

mailcatcher --instance site1 --smtp-ip 127.0.0.1 --smtp-port 1025 --http-ip 0.0.0.0 --http-port 8025
mailcatcher --instance site2 --smtp-ip 127.0.0.1 --smtp-port 1025 --http-ip 0.0.0.0 --http-port 8025

I'll try to create a PR if this is something that might be added.

Rails 3.0.3 issues

This will not work with Rails 3.0.3/3.0.9 as these versions depend on mail ~>2.2.19 and mailcatcher depends on mail 2.3.0 - is there any reason for mailcatcher needing the next major version up? Seems a shame I can't use this great tool in a Rails 3 app. Upgrading to 3.1 is not an option at present.

Rails 4 support

With mailcatcher and rails 4.0.0.beta1, launch app failed becaus of depedence with activesupport
s.add_dependency "activesupport", "~> 3.0"

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.