Giter Club home page Giter Club logo

inbucket's Introduction

Build Status Docker Image

Inbucket

Inbucket is an email testing service; it will accept messages for any email address and make them available via web, REST and POP3 interfaces. Once compiled, Inbucket does not have any external dependencies - HTTP, SMTP, POP3 and storage are all built in.

A Go client for the REST API is available in github.com/inbucket/inbucket/pkg/rest/client - Go API docs

Read more at the Inbucket Website

Screenshot

Development Status

Inbucket is currently production quality: it is being used for real work.

Please see the Change Log and Issues List for more details. If you'd like to contribute code to the project check out CONTRIBUTING.md.

Docker

Inbucket has automated Docker Image builds via Docker Hub. The latest tag tracks our tagged releases, and edge tracks our potentially unstable main branch.

Building from Source

You will need functioning Go and Node.js installations for this to work.

git clone https://github.com/inbucket/inbucket.git
cd inbucket/ui
yarn install
yarn build
cd ..
go build ./cmd/inbucket

For more information on building and development flows, check out the Development Quickstart page of our wiki.

Configure and Launch

Inbucket reads its configuration from environment variables, but comes with reasonable defaults built-in. It should work on most Unix and OS X machines as is. Launch the daemon:

./inbucket

By default the SMTP server will be listening on localhost port 2500 and the web interface will be available at localhost:9000.

See doc/config.md for more information on configuring Inbucket, but you will likely find the Configurator tool the easiest way to generate a configuration.

About

Inbucket is written in Go and Elm.

Inbucket is open source software released under the MIT License. The latest version can be found at https://github.com/inbucket/inbucket

inbucket's People

Contributors

abirdcfly avatar adrium avatar bimargulies-google avatar blueicarus avatar corey-aloia avatar cpanato avatar cyd01 avatar danielsimkus avatar dependabot[bot] avatar evilmrburns avatar hotei avatar jhillyerd avatar kaustubh105 avatar kingforaday avatar makarchuk avatar matthewjohn avatar mcfedr avatar nerones avatar s4uliu5 avatar sascha-andres avatar shantanugadgil avatar stuartskelton avatar testwill avatar tommywo avatar wissnia 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

inbucket's Issues

Retention scanner needs shutdown flag

The retention scanner does not know when Inbucket is trying to shut down. This can prevent a quick shut down in an install with thousands of messages.

Systemd config for Inbucket

To run Inbucket on Ubuntu 16.04 LTS, we will need to:

  • rename etc/ubuntu-12 to etc/ubuntu
  • create systemd service unit file

For RedHat el7

  • rename etc/redhat-el6 to etc/redhat
  • update redhat support files
  • update CHANGELOG

Add information about attachments in REST API

I would see it llike that:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 810
Date: Thu, 17 Oct 2013 21:51:59 GMT

{
    "mailbox": "swaks",
    "id": "20131016T164638-0001",
    "from": "[email protected]",
    "subject": "Swaks HTML",
    "date": "2013-10-16T16:46:38.646370568-07:00",
    "size": 705,
    "body": {
        "text": "This is a test mailing.\r\n\r\nThis should be clickable: http://google.com/\r\n",
        "html": "<html>\n<body>\n<p>This is a test mailing <b>in HTML</b></p>\n\n<p>This should be clickable: [...]"
    },
    "header": {
        "Content-Type": [
            "multipart/alternative; boundary=\"----=_MIME_BOUNDARY_000_62717\""
        ],
        "Date": [
            "Wed, 16 Oct 2013 16:46:38 -0700"
        ],
        "From": [
            "[email protected]"
        ],
        "Mime-Version": [
            "1.0"
        ],
        "Subject": [
            "Swaks HTML"
        ],
        "To": [
            "[email protected]"
        ]
    },
   "attachments": [
    {
      "filename": "file.png",
      "content-type": "image/png",
      "downloadLink": "linkHere",
      "viewLink": "linkHere",
      "md5: "hashHere"
     }
    ]
}

Feature: Add domain "whitelist" parameter

Instead of having a blacklist domain.nostore it would be great to have a whitelist (domain.dostore?) which, if set, rejects all mails not having a recipient on that domain(s).

Use-Case: I'm using Inbucket as a single-purpose-mailbox SMTP server for those "enter your email address to get your download link sent to you - and well, we will spam you with newsletters afterwards"-things… Sadly spammers seem to think this SMTP will redirect their messages to whomever they want… Having all that crap not using my domain rejected would be great…

image

Clear button does not work on Monitor page

When retention.minutes=0 is set, the Clear button does not have a lasting effect.

The list of messages is momentarily cleared, but when the page is reloaded, the list of messages is repopulated.

Using the API to clear a mailbox also does not clear the Monitor page.

Handle signals

Handle signals for cleaner shutdown, support log file rotation

Feature: Include a chaos monkey

Include a chaos monkey feature - ala Netflix, MailHog

This would allow the rejection of messages

  • Reject recipients (specific email addresses and/or domains)
  • Reject connections (random, but configurable - e.g. 0.5% of connections)
  • Rate limit connections (e.g. 10-100kbps)
  • Reject senders (specific email addresses and/or domains)

Go Client for REST API

Hello

this project have a Go driver? then I can use to integrate with my go project? for testing?

thanks

FROM address local part length limited to 64 characters

Mailgun - inbucket communication is difficult with this limitation because Mailgun adds metadata to FROM address and makes the local part exceed 64 characters.

Limitation is located in smtpd/utils.go.

According to our testing, allowing 128 characters resolves this problem.

Docker image should run non-root

Inbucket currently runs as root inside a docker container. The build, install and startup scripts should be modified such that it runs as a non-privileged user account.

Metric terminology

With the addition of load-test mode, the number of messages received by SMTP may not be the same as the number of messages delivered. The metric should be renamed from "Messages Delivered" to "Messages Received"

Add support to redirect email by replacing the recipients

This is a specific feature I require for an email development server.
Use case: Need to test email in outlook webapp and I can't make an account for every random recipient that I want to test for. Currently we have to change the data to point to a specific account however this is undesirable for a proper development environment.
My solution is to point my application to an email dev server that will replace all incoming mail recipients with a configured email address (I'm usually more interested in the contents of email than the recipients, but we can add the original recipients somewhere in the email for reference, maybe the subject).
This would also come in useful for when testing on a desktop client with pop3 to prevent having to create an account for every email address that we need to test. The webui is nice, but we often need to test email in a specific client to make sure it is formatted correctly.

To complete this it would require a separate issue that allows forwarding emails to another smtp server, however I won't create that issue unless you're interested in having this feature integrated into the codebase.

This would use a feature flag, ie. only use this feature if the developer wants it.
No current functionality should need to be broken to support this feature.

Not sure if anyone else has a need for this, but I would create a PR for this if anyone's interested.

Handling of empty message data

Inbucket fails silently when it receives a message with no DATA (no headers or body). Postfix accepts this sort of mail. What should Inbucket do?

Extract smtpd test mocks

Extract smtpd test mocks into their own file (similar to rest pkg) - too hard to find mixed with unit test code.

Need to sanitize HTML

Inbucket presently makes no effort to sanitize HTML message bodies before displaying them. Research needs to be done on best practices, if we go overboard stripping things out it will reduce the usefulness of Inbucket for developers.

Design limits handling large mailing lists

The design of inbucket means that inbucket keeps a file handle open for every mailbox that it is delivering mail to until it's done processing the email. The result is that large mailing lists can run the process out of file handles before email processing is finished, causing some mail to not be delivered into some mail boxes.

Web/REST errors should be handled consistently

Web page errors should redirect and add a session flash.
Web partial errors should return HTTP 500 + error text* (no redirect).
REST errors should return HTTP 500 + error text* (no redirect).

* Or HTTP 404 if resource not found

goxc build vars are quoted

On the status page, rc1 has: '1.1.0-rc1', built on '2016-03-03T21:46:41-08:00'

There should not be single quotes around the version and date - goxc appears to be linking that in.

HTML view does not set character encoding

Inbucket decodes MIME parts into UTF-8, but does not set UTF-8 character encoding on the HTML view popup window- encoded characters show up as multi-byte garbage.

Basic authentication

Introduce basic authentication to prevent unauthorized access to the web application on a corporate network.

Feature - Add the possibility to get the latest message

We use inbucket and sometimes I would like to get the latest message.

What do you think to add a new endpoint to get the latest message?
I think I can do that if you agree.

I have a question:

for _, m := range mb.messages {
	if m.Fid == id {
		return m, nil
	}
}

Is the array order? if I get the last item will be the latest message?

thanks!

Cannot connect o UI in jenkins/kubernetes

Hello

I've set up a Jenkins to run pods in K8s and one pod I have an inbucket container.
However, I cannot connect to inbucket using the 9000 port, it works only with 10080. I also setup the host/container port but did not work :/

anytips? thanks!

this is a the config I'm using

podTemplate(label: 'jenkins-slave',
    containers: [
        containerTemplate(
            name: 'mysql',
            image: 'mysql:5.7',
            alwaysPullImage: false,
            resourceRequestCpu: '1000m',
            resourceLimitCpu: '2000m',
            resourceRequestMemory: '2Gi',
            resourceLimitMemory: '4Gi',
            ports: [portMapping(name: 'mysql', containerPort: 3306, hostPort: 3306)],
            envVars: [envVar(key: 'MYSQL_ROOT_PASSWORD', value: 'xxxxx'), envVar(key: 'MYSQL_USER', value: 'xxxx'), envVar(key: 'MYSQL_PASSWORD', value: 'xxxxx'), envVar(key: 'MYSQL_DATABASE', value: 'xxxxx')]
        ),
        containerTemplate(
            name: 'golang',
            image: 'golang:1.8',
            ttyEnabled: true,
            command: 'cat',
            alwaysPullImage: false,
            resourceRequestCpu: '1000m',
            resourceLimitCpu: '2000m',
            resourceRequestMemory: '2Gi',
            resourceLimitMemory: '4Gi'
        ),
        containerTemplate(
            name: 'inbucket',
            image: 'jhillyerd/inbucket:latest',
            ports: [portMapping(name: 'inbucket', hostPost: 9000, containerPort: 10080), portMapping(name: 'inbucket2', hostPost: 2500, containerPort: 10025)],
            resourceRequestCpu: '250m',
            resourceLimitCpu: '250m',
            resourceRequestMemory: '256Mi',
            resourceLimitMemory: '256Mi'
        ),
        containerTemplate(
            name: 'redis',
            image: 'redis',
            ports: [portMapping(name: 'redis', hostPost: 6379, containerPort: 6379)],
            resourceRequestCpu: '250m',
            resourceLimitCpu: '250m',
            resourceRequestMemory: '256Mi',
            resourceLimitMemory: '256Mi'
        )
    ]
)
{
node('jenkins-slave') {
    stage('test') {
        container('golang') {
            sh 'curl http://localhost:9000'
        }
    }
  }
}

Parse MIME email

Parse MIME encoded message bodies so that text is rendered without = at the front of each line.

Create unit tests for POP3 server

The POP3 server (pop3d package) does not have any unit tests. The golang net/textproto package could be used to create some.

See smtpd/handler_test.go for examples

http panic while clicking on a message in a busy mailbox

Occurred while running linux-amd64 1.0-rc2 build

2013/11/08 14:59:46 http: panic serving 10.1.20.205:64355: runtime error: invalid memory address or nil pointer dereference
goroutine 2359 [running]:
net/http.func·007()
    /usr/local/go/src/pkg/net/http/server.go:1022 +0xac
os.(*File).Close(0x0, 0x63, 0x0)
    /usr/local/go/src/pkg/os/file_unix.go:99 +0x1c
github.com/jhillyerd/inbucket/smtpd.(*FileMessage).ReadHeader(0xc242c3d460, 0x0, 0xc20241fa20, 0xc205fda9f0)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/smtpd/filestore.go:335 +0xa1
github.com/jhillyerd/inbucket/web.MailboxShow(0xc2001be380, 0xc21e19f2d0, 0xc2002b4c30, 0xc205fda390, 0x0, ...)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/web/mailbox_controller.go:126 +0x3da
github.com/jhillyerd/inbucket/web.handler.ServeHTTP(0x7e4d18, 0xc2001ac040, 0xc242c56d90, 0xc2002b4c30)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/web/server.go:116 +0x34b
github.com/gorilla/mux.(*Router).ServeHTTP(0xc200165780, 0xc2001ac040, 0xc242c56d90, 0xc2002b4c30)
    /home/jamehi03/devel/godeps/src/github.com/gorilla/mux/mux.go:90 +0x1e1
net/http.(*ServeMux).ServeHTTP(0xc2000c9510, 0xc2001ac040, 0xc242c56d90, 0xc2002b4c30)
    /usr/local/go/src/pkg/net/http/server.go:1416 +0x11d
net/http.serverHandler.ServeHTTP(0xc20019e500, 0xc2001ac040, 0xc242c56d90, 0xc2002b4c30)
    /usr/local/go/src/pkg/net/http/server.go:1517 +0x16c
net/http.(*conn).serve(0xc223f76d80)
    /usr/local/go/src/pkg/net/http/server.go:1096 +0x765
created by net/http.(*Server).Serve
    /usr/local/go/src/pkg/net/http/server.go:1564 +0x266
2013/11/08 14:59:46 http: panic serving 10.1.20.205:64517: runtime error: invalid memory address or nil pointer dereference
goroutine 3749 [running]:
net/http.func·007()
    /usr/local/go/src/pkg/net/http/server.go:1022 +0xac
os.(*File).Close(0x0, 0x63, 0x0)
    /usr/local/go/src/pkg/os/file_unix.go:99 +0x1c
github.com/jhillyerd/inbucket/smtpd.(*FileMessage).ReadHeader(0xc2420264d0, 0x0, 0xc20241fa20, 0xc216136600)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/smtpd/filestore.go:335 +0xa1
github.com/jhillyerd/inbucket/web.MailboxShow(0xc2001be380, 0xc238c3abd0, 0xc20c1684e0, 0xc2161361e0, 0x0, ...)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/web/mailbox_controller.go:126 +0x3da
github.com/jhillyerd/inbucket/web.handler.ServeHTTP(0x7e4d18, 0xc2001ac040, 0xc242033e00, 0xc20c1684e0)
    /home/jamehi03/devel/gocode/src/github.com/jhillyerd/inbucket/web/server.go:116 +0x34b
github.com/gorilla/mux.(*Router).ServeHTTP(0xc200165780, 0xc2001ac040, 0xc242033e00, 0xc20c1684e0)
    /home/jamehi03/devel/godeps/src/github.com/gorilla/mux/mux.go:90 +0x1e1
net/http.(*ServeMux).ServeHTTP(0xc2000c9510, 0xc2001ac040, 0xc242033e00, 0xc20c1684e0)
    /usr/local/go/src/pkg/net/http/server.go:1416 +0x11d
net/http.serverHandler.ServeHTTP(0xc20019e500, 0xc2001ac040, 0xc242033e00, 0xc20c1684e0)
    /usr/local/go/src/pkg/net/http/server.go:1517 +0x16c
net/http.(*conn).serve(0xc238c3aa20)
    /usr/local/go/src/pkg/net/http/server.go:1096 +0x765
created by net/http.(*Server).Serve
    /usr/local/go/src/pkg/net/http/server.go:1564 +0x266

Add list-all-mails function in WebUI

In order not to search for the mailbox containing mails (or even worse trying to find the hash in a hash database) when you do not want to remember which addresses had mails sent to, please allow either a list of mailboxes containing more than zero mails or allow a wildcard in the mailbox name.

Though it's a bit lazy I'm not able to remember which addresses do have mails sent to but I eventually need to look at those mails. Having the data store metric "Currently Retained: 15" I know there are messages and I could take a look into the filesystem to identify those 15 mails but having a UI method to list those messages either by a list of mailboxes or a * search returning all 15 mails as if they were in a single mailbox would be way more convenient.

No email address validation

Right now Inbucket will let pretty much any email address through, and some of them may not be accessible via the web interface.

I think the domain part of the address should be validated per RFC3696, but we should determine our own set of rules for the local-part.

Survey: Is Revel a barrier to adoption?

I've had a couple questions from people on why I chose to use the Revel Web Framework. The answer is that I chose to build Inbucket with it the because I wanted to try out Revel, not because any Inbucket functionality required it.

My question for you, does the install of Revel prevent a barrier to adoption? Now would be the best time to shift to a simpler net/http+ Gorilla web interface if that's what people prefer.

HTML not recognized at top-level

If the entire message is HTML (Content-Type: text/html as SMTP header), Inbucket displays the message as text and does not offer an HTML view.

Display HTML email

Provide a button that will display the text/html section of a MIME message body in a new window.

Allow POP3 access

Providing POP3 access to the Inbucket datastore would allow emails to be previewed in multiple email clients

Sparklines starting at 0

Server side histories are being rendered as starting at zero, even though the server is returning the correct numbers.

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.