{"id":13400409,"url":"https://github.com/flashmob/go-guerrilla","last_synced_at":"2025-05-14T07:11:00.974Z","repository":{"id":5472423,"uuid":"6668632","full_name":"flashmob/go-guerrilla","owner":"flashmob","description":"Mini SMTP server written in golang","archived":false,"fork":false,"pushed_at":"2024-06-04T11:33:17.000Z","size":14448,"stargazers_count":2834,"open_issues_count":53,"forks_count":370,"subscribers_count":88,"default_branch":"master","last_synced_at":"2025-04-09T02:17:20.957Z","etag":null,"topics":["go","mail-delivery-agent","mda","server","smtp","smtp-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flashmob.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-11-13T10:03:26.000Z","updated_at":"2025-04-08T02:24:55.000Z","dependencies_parsed_at":"2024-06-18T12:15:42.977Z","dependency_job_id":"31a83e60-ef6c-4fbe-ac36-ef2abdbff248","html_url":"https://github.com/flashmob/go-guerrilla","commit_stats":{"total_commits":126,"total_committers":22,"mean_commits":"5.7272727272727275","dds":0.3412698412698413,"last_synced_commit":"aa54b3ac4a0b4b34232fd29239422d024ad9395e"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashmob%2Fgo-guerrilla","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashmob%2Fgo-guerrilla/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashmob%2Fgo-guerrilla/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flashmob%2Fgo-guerrilla/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flashmob","download_url":"https://codeload.github.com/flashmob/go-guerrilla/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092798,"owners_count":22013292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","mail-delivery-agent","mda","server","smtp","smtp-server"],"created_at":"2024-07-30T19:00:51.723Z","updated_at":"2025-05-14T07:10:55.958Z","avatar_url":"https://github.com/flashmob.png","language":"Go","readme":"\n\u003e [!IMPORTANT]\n\u003e Hi, my name is Philipp and I am one of the contributors to this project.\n\u003e Sadly it seems as if the original owner has abandonded go-guerilla.\n\u003e As I think there are still some nice things to do with it, and there might\n\u003e be some issues here and there, I have decided to revive this project.\n\u003e\n\u003e I've already mirrored the repository to https://github.com/phires/go-guerrilla\n\u003e as I have not complete full access to this repo and don't know if it will\n\u003e disappear at some point.\n\u003e I will also try to migrate all further relevant informations (e.g. Wiki\n\u003e and Issues) over to the new repo.\n\u003e\n\u003e If the original owner decides to come back I'll glady hand over full control\n\u003e of the projekt back to him. This should by no means be misinterpreted as a\n\u003e \"hostile takeover\" or anything. I just want to get this mighty fine piece\n\u003e of software back to speed and give it some further development.\n\u003e\n\u003e     -- 2023-08-31 Philipp\n\n\nLatest: v1.6.1, tagged on Dec 28, 2019 (Pull requests from #129 to #203)\n\nGo-Guerrilla SMTP Daemon\n====================\n\nA lightweight SMTP server written in Go, made for receiving large volumes of mail.\nTo be used as a package in your Go project, or as a stand-alone daemon by running the \"guerrillad\" binary.\n\nSupports MySQL and Redis out-of-the-box, with many other vendor provided _processors_,\nsuch as [MailDir](https://github.com/flashmob/maildir-processor) and even [FastCGI](https://github.com/flashmob/fastcgi-processor)! \nSee below for a list of available processors.\n\n![Go Guerrilla](/GoGuerrilla.png)\n\n### What is Go-Guerrilla?\n\nIt's an SMTP server written in Go, for the purpose of receiving large volumes of email.\nIt started as a project for GuerrillaMail.com which processes millions of emails every day,\nand needed a daemon with less bloat \u0026 written in a more memory-safe language that can \ntake advantage of modern multi-core architectures.\n\nThe purpose of this daemon is to grab the email, save it,\nand disconnect as quickly as possible, essentially performing the services of a\nMail Transfer Agent (MTA) without the sending functionality.\n\nThe software also includes a modular backend implementation, which can extend the email\nprocessing functionality to whatever needs you may require. We refer to these modules as \n\"_Processors_\". Processors can be chained via the config to perform different tasks on \nreceived email, or to validate recipients.\n\nSee the list of available _Processors_ below.\n\nFor more details about the backend system, see the:\n[Backends, configuring and extending](https://github.com/flashmob/go-guerrilla/wiki/Backends,-configuring-and-extending) page.\n\n### License\n\nThe software is using MIT License (MIT) - contributors welcome.\n\n### Features\n\n#### Main Features\n\n- Multi-server. Can spawn multiple servers, all sharing the same backend\nfor saving email.\n- Config hot-reloading. Add/Remove/Enable/Disable servers without restarting. \nReload TLS configuration, change most other settings on the fly.\n- Graceful shutdown: Minimise loss of email if you need to shutdown/restart.\n- Be a gentleman to the garbage collector: resources are pooled \u0026 recycled where possible.\n- Modular [Backend system](https://github.com/flashmob/go-guerrilla/wiki/Backends,-configuring-and-extending) \n- Modern TLS support (STARTTLS or SMTPS).\n- Can be [used as a package](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package) in your Go project. \nGet started in just a few lines of code!\n- [Fuzz tested](https://github.com/flashmob/go-guerrilla/wiki/Fuzz-testing). \n[Auto-tested](https://travis-ci.org/flashmob/go-guerrilla). Battle Tested.\n\n#### Backend Features\n\n- Arranged as workers running in parallel, using a producer/consumer type structure, \n taking advantage of Go's channels and go-routines. \n- Modular [backend system](https://github.com/flashmob/go-guerrilla/wiki/Backends,-configuring-and-extending)\n structured using a [decorator-like pattern](https://en.wikipedia.org/wiki/Decorator_pattern) which allows the chaining of components (a.k.a. _Processors_) via the config.  \n- Different ways for processing / delivering email: Supports MySQL and Redis out-of-the box, many other \nvendor provided processors available.\n\n### Roadmap / Contributing \u0026 Bounties\n\nPull requests / issue reporting \u0026 discussion / code reviews always \nwelcome. To encourage more pull requests, we are now offering bounties. \n\nTake a look at our [Bounties and Roadmap](https://github.com/flashmob/go-guerrilla/wiki/Roadmap-and-Bounties) page!\n\n\nGetting started\n===========================\n\n(Assuming that you have GNU make and latest Go on your system)\n\n#### Dependencies\n\nGo-Guerrilla uses [Dep](https://golang.github.io/dep/) to manage \ndependencies. If you have dep installed, just run `dep ensure` as usual.\n \nYou can also run `$ go get ./..` if you don't want to use dep, and then run `$ make test`\nto ensure all is good.\n\nTo build the binary run:\n\n```\n$ make guerrillad\n```\n\nThis will create a executable file named `guerrillad` that's ready to run.\nSee the [build notes](https://github.com/flashmob/go-guerrilla/wiki/Build-Notes) for more details.\n\nNext, copy the `goguerrilla.conf.sample` file to `goguerrilla.conf.json`. \nYou may need to customize the `pid_file` setting to somewhere local, \nand also set `tls_always_on` to false if you don't have a valid certificate setup yet. \n\nNext, run your server like this:\n\n`$ ./guerrillad serve`\n\nThe configuration options are detailed on the [configuration page](https://github.com/flashmob/go-guerrilla/wiki/Configuration). \nThe main takeaway here is:\n\nThe default configuration uses 3 _processors_, they are set using the `save_process` \nconfig option. Notice that it contains the following value: \n`\"HeadersParser|Header|Debugger\"` - this means, once an email is received, it will\nfirst go through the `HeadersParser` processor where headers will be parsed.\nNext, it will go through the `Header` processor, where delivery headers will be added.\nFinally, it will finish at the `Debugger` which will log some debug messages.\n\nWhere to go next?\n\n- Try setting up an [example configuration](https://github.com/flashmob/go-guerrilla/wiki/Configuration-example:-save-to-Redis-\u0026-MySQL) \nwhich saves email bodies to Redis and metadata to MySQL.\n- Try importing some of the 'vendored' processors into your project. See [MailDiranasaurus](https://github.com/flashmob/maildiranasaurus)\nas an example project which imports the [MailDir](https://github.com/flashmob/maildir-processor) and [FastCGI](https://github.com/flashmob/fastcgi-processor) processors.\n- Try hacking the source and [create your own processor](https://github.com/flashmob/go-guerrilla/wiki/Backends,-configuring-and-extending).\n- Once your daemon is running, you might want to stup [log rotation](https://github.com/flashmob/go-guerrilla/wiki/Automatic-log-file-management-with-logrotate).\n\n\n\nUse as a package\n============================\nGo-Guerrilla can be imported and used as a package in your Go project.\n\n### Quickstart\n\n\n#### 1. Import the guerrilla package\n```go\nimport (\n    \"github.com/flashmob/go-guerrilla\"\n)\n\n\n```\n\nYou should use the `dep ensure` command to get all dependencies, as Go-Guerrilla uses \n[dep](https://golang.github.io/dep/) for dependency management. \n\nOtherise, ``$ go get ./...`` should work if you're in a hurry.\n\n#### 2. Start a server\n\nThis will start a server with the default settings, listening on `127.0.0.1:2525`\n\n\n```go\n\nd := guerrilla.Daemon{}\nerr := d.Start()\n\nif err == nil {\n    fmt.Println(\"Server Started!\")\n}\n```\n\n`d.Start()` *does not block* after the server has been started, so make sure that you keep your program busy.\n\nThe defaults are: \n* Server listening to 127.0.0.1:2525\n* use your hostname to determine your which hosts to accept email for\n* 100 maximum clients\n* 10MB max message size \n* log to Stderror, \n* log level set to \"`debug`\"\n* timeout to 30 sec \n* Backend configured with the following processors: `HeadersParser|Header|Debugger` where it will log the received emails.\n\nNext, you may want to [change the interface](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#starting-a-server---custom-listening-interface) (`127.0.0.1:2525`) to the one of your own choice.\n\n#### API Documentation topics\n\nPlease continue to the [API documentation](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package) for the following topics:\n\n\n- [Suppressing log output](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#starting-a-server---suppressing-log-output)\n- [Custom listening interface](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#starting-a-server---custom-listening-interface)\n- [What else can be configured](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#what-else-can-be-configured)\n- [Backends](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#backends)\n    - [About the backend system](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#about-the-backend-system)\n    - [Backend Configuration](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#backend-configuration)\n    - [Registering a Processor](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#registering-a-processor)\n- [Loading config from JSON](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#loading-config-from-json)\n- [Config hot-reloading](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#config-hot-reloading)\n- [Logging](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#logging-stuff)\n- [Log re-opening](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#log-re-opening)\n- [Graceful shutdown](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#graceful-shutdown)\n- [Pub/Sub](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#pubsub)\n- [More Examples](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#more-examples)\n\nUse as a Daemon\n==========================================================\n\n### Manual for using from the command line\n\n- [guerrillad command](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#guerrillad-command)\n    - [Starting](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#starting)\n    - [Re-loading configuration](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#re-loading-the-config)\n    - [Re-open logs](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#re-open-log-file)\n    - [Examples](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#examples)\n\n### Other topics\n\n- [Using Nginx as a proxy](https://github.com/flashmob/go-guerrilla/wiki/Using-Nginx-as-a-proxy)\n- [Testing STARTTLS](https://github.com/flashmob/go-guerrilla/wiki/Running-from-command-line#testing-starttls)\n- [Benchmarking](https://github.com/flashmob/go-guerrilla/wiki/Profiling#benchmarking)\n\n\nEmail Processing Backend\n=====================\n\nThe main job of a Go-Guerrilla backend is to validate recipients and deliver emails. The term\n\"delivery\" is often synonymous with saving email to secondary storage.\n\nThe default backend implementation manages multiple workers. These workers are composed of \nsmaller components called \"Processors\" which are chained using the config to perform a series of steps.\nEach processor specifies a distinct feature of behaviour. For example, a processor may save\nthe emails to a particular storage system such as MySQL, or it may add additional headers before \npassing the email to the next _processor_.\n\nTo extend or add a new feature, one would write a new Processor, then add it to the config.\nThere are a few default _processors_ to get you started.\n\n\n### Included Processors\n\n| Processor | Description |\n|-----------|-------------|\n|Compressor|Sets a zlib compressor that other processors can use later|\n|Debugger|Logs the email envelope to help with testing|\n|Hasher|Processes each envelope to produce unique hashes to be used for ids later|\n|Header|Add a delivery header to the envelope|\n|HeadersParser|Parses MIME headers and also populates the Subject field of the envelope|\n|MySQL|Saves the emails to MySQL.|\n|Redis|Saves the email data to Redis.|\n|GuerrillaDbRedis|A 'monolithic' processor used at Guerrilla Mail; included for example\n\n### Available Processors\n\nThe following processors can be imported to your project, then use the\n[Daemon.AddProcessor](https://github.com/flashmob/go-guerrilla/wiki/Using-as-a-package#registering-a-processor) function to register, then add to your config.\n\n| Processor | Description |\n|-----------|-------------|\n|[MailDir](https://github.com/flashmob/maildir-processor)|Save emails to a maildir. [MailDiranasaurus](https://github.com/flashmob/maildiranasaurus) is an example project|\n|[FastCGI](https://github.com/flashmob/fastcgi-processor)|Deliver email directly to PHP-FPM or a similar FastCGI backend.|\n|[WildcardProcessor](https://github.com/DevelHell/wildcard-processor)|Use wildcards for recipients host validation.|\n\nHave a processor that you would like to share? Submit a PR to add it to the list!\n\nReleases\n========\n\nCurrent release: 1.5.1 - 4th Nov 2016\n\nNext Planned release: 2.0.0 - TBA\n\nSee our [change log](https://github.com/flashmob/go-guerrilla/wiki/Change-Log) for change and release history\n\n\nUsing Nginx as a proxy\n======================\n\nFor such purposes as load balancing, terminating TLS early,\n or supporting SSL versions not supported by Go (highly not recommended if you\n want to use older TLS/SSL versions), \n it is possible to [use NGINX as a proxy](https://github.com/flashmob/go-guerrilla/wiki/Using-Nginx-as-a-proxy).\n\n\n\nCredits\n=======\n\nProject Lead: \n-------------\nFlashmob, GuerrillaMail.com, Contact: flashmob@gmail.com\n\nMajor Contributors: \n-------------------\n\n* Reza Mohammadi https://github.com/remohammadi\n* Jordan Schalm https://github.com/jordanschalm \n* Philipp Resch https://github.com/dapaxx\n\nThanks to:\n----------\n* https://github.com/dvcrn\n* https://github.com/athoune\n* https://github.com/Xeoncross\n\n... and anyone else who opened an issue / sent a PR / gave suggestions!\n","funding_links":[],"categories":["Go","开源类库","Open source library","Repositories"],"sub_categories":["邮件","Post Office"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashmob%2Fgo-guerrilla","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflashmob%2Fgo-guerrilla","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflashmob%2Fgo-guerrilla/lists"}