{"id":18409915,"url":"https://github.com/toorop/tmail","last_synced_at":"2025-04-06T07:13:30.290Z","repository":{"id":7730004,"uuid":"9096281","full_name":"toorop/tmail","owner":"toorop","description":"Golang SMTP server","archived":false,"fork":false,"pushed_at":"2022-12-28T15:59:04.000Z","size":7255,"stargazers_count":324,"open_issues_count":5,"forks_count":55,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-30T06:07:09.553Z","etag":null,"topics":["golang","mail","server","smtp","smtp-server"],"latest_commit_sha":null,"homepage":"http://tmail.io","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/toorop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-29T10:05:46.000Z","updated_at":"2025-03-15T23:20:03.000Z","dependencies_parsed_at":"2023-01-13T14:28:47.599Z","dependency_job_id":null,"html_url":"https://github.com/toorop/tmail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toorop%2Ftmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toorop%2Ftmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toorop%2Ftmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toorop%2Ftmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toorop","download_url":"https://codeload.github.com/toorop/tmail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445671,"owners_count":20939958,"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":["golang","mail","server","smtp","smtp-server"],"created_at":"2024-11-06T03:27:56.686Z","updated_at":"2025-04-06T07:13:30.271Z","avatar_url":"https://github.com/toorop.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tmail\n\n[![Join the chat at https://gitter.im/toorop/tmail](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/toorop/tmail?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\ntmail is a SMTP server\n\n## Features\n\n * SMTP, SMTP over SSL, ESMTP (SIZE, AUTH PLAIN, STARTTLS)\n * Advanced routing for outgoing mails (failover and round robin on routes, route by recipient, sender, authuser... )\n * SMTPAUTH (plain \u0026 cram-md5) for in/outgoing mails\n * STARTTLS/SSL for in/outgoing connexions.\n * Manageable via CLI or REST API.\n * DKIM support for signing outgoing mails.\n * Builtin support of clamav (open-source antivirus scanner).\n * Builtin Dovecot (imap server) support.\n * Fully extendable via plugins\n * Easy to deploy\n * No dependencies: -\u003e you do not have to install nor maintain libs\n * Clusterisable (todo)\n * IPV6 (soon)\n\n\n## Quick install on linux (Ubuntu)\n\nFor french users see: http://tmail.io/doc/installer-tmail/\n\n### add user tmail\n\n\tadduser tmail\n\n### Fetch tmail dist\n\n\t# su tmail\n\t$ cd\n\t$ wget ftp://ftp.toorop.fr/softs/tmail/tmail.zip\n\t$ unzip tmail.zip\n\t$ cd dist\n\nUnder dist you will find:\n\n* conf: configuration.\n* run: script used to launch tmail\n* ssl: is the place to store SSL cert. For testing purpose you can use those included.\n* tmail: tmail binary\n* tpl: text templates.\n* db: if you use sqlite as DB backend (MySQL and Postgresql are also supported), sqlite file will be stored in this directory.\n* store: mainly used to store raw email when they are in queue. (others kind of backend/storage engine are coming)\n* mailboxes: where mailboxes are stored if you activate Dovecot support.\n\nMake run script and tmail runnable:\n\n\tchmod 700 run tmail\n\nadd directories:\n\n\tmkdir db\n\tmkdir store\n\n\nif you want to enable Dovecot support add mailboxes directory:\n\n\tmkdir mailboxes\n\nSee [Enabling Dovecot support for tmail (french)](http://tmail.io/doc/mailboxes/) for more info.\n\n\n### Configuration\n\nInit you conf file:\n\n\tcd conf\n\tcp tmail.cfg.base tmail.cfg\n\tchmod 600 tmail.cfg\n\n* TMAIL_ME: Hostname of the SMTP server (will be used for HELO|EHLO)\n\n* TMAIL_DB_DRIVER: I recommend sqlite3 unless you want to enable clustering (or you have a lot of domains/mailboxes)\n\n* TMAIL_SMTPD_DSNS: listening IP(s), port(s) and SSL options (see conf file for more info)\n\n* TMAIL_DELIVERD_LOCAL_IPS: IP(s) to use for sending mail to remote host.\n\n* TMAIL_SMTPD_CONCURRENCY_INCOMING: max concurent incomming proccess\n\n* TMAIL_DELIVERD_MAX_IN_FLIGHT: concurrent delivery proccess\n\n\n### Init database\n\n\ttmail@dev:~/dist$ ./run\n\tDatabase 'driver: sqlite3, source: /home/tmail/dist/db/tmail.db' misses some tables.\n\tShould i create them ? (y/n): y\n\n\t[dev.tmail.io - 127.0.0.1] 2015/02/02 12:42:32.449597 INFO - smtpd 151.80.115.83:2525 launched.\n\t[dev.tmail.io - 127.0.0.1] 2015/02/02 12:42:32.449931 INFO - smtpd 151.80.115.83:5877 launched.\n\t[dev.tmail.io - 127.0.0.1] 2015/02/02 12:42:32.450011 INFO - smtpd 151.80.115.83:4655 SSL launched.\n\t[dev.tmail.io - 127.0.0.1] 2015/02/02 12:42:32.499728 INFO - deliverd launched\n\n### Port forwarding\n\nAs you run tmail under tmail user, it can't open port under 1024 (and for now tmail can be launched as root, open port under 25 and fork itself to unprivilegied user).\n\nThe workaround is to use iptables to forward ports.\nFor example, if we have tmail listening on ports 2525, and 5877 and we want tu use 25 and 587 as public ports, we have to use those iptables rules:\n\n\tiptables -t nat -A PREROUTING -p tcp --dport 25 -j REDIRECT --to-port 2525\n\tiptables -t nat -A PREROUTING -p tcp --dport 587 -j REDIRECT --to-port 5877\n\n### First test\n\n\t$ telnet dev.tmail.io 25\n\tTrying 151.80.115.83...\n\tConnected to dev.tmail.io.\n\tEscape character is '^]'.\n\t220 tmail.io  tmail ESMTP f22815e0988b8766b6fe69cbc73fb0d965754f60\n\tHELO toto\n\t250 tmail.io\n\tMAIL FROM: toorop@tmail.io\n\t250 ok\n\tRCPT TO: toorop@tmail.io\n\t554 5.7.1 \u003ctoorop@tmail.io\u003e: Relay access denied.\n\tConnection closed by foreign host.\n\nPerfect !\nYou got \"Relay access denied\" because by default noboby can use tmail for relaying mails.\n\n### Relaying mails for @example.com\n\nIf you want tmail to relay mails for example.com, just run:\n\n\ttmail rcpthost add example.com\n\nNote: If you have activated Dovecot support and example.com is a local domain, add -l flag :\n\n\ttmail rcpthost add -l example.com\n\nDoes it work as expected ?\n\n\t$ telnet dev.tmail.io 25\n\tTrying 151.80.115.83...\n\tConnected to dev.tmail.io.\n\tEscape character is '^]'.\n\t220 tmail.io  tmail ESMTP 96b78ef8f850253cc956820a874e8ce40773bfb7\n\tHELO toto\n\t250 tmail.io\n\tmail from: toorop@toorop.fr\n\t250 ok\n\trcpt to: toorop@example.com\n\t250 ok\n\tdata\n\t354 End data with \u003cCR\u003e\u003cLF\u003e.\u003cCR\u003e\u003cLF\u003e\n\tsubject: test tmail\n\n\tblabla\n\t.\n\t250 2.0.0 Ok: queued 2736698d73c044fd7f1994e76814d737c702a25e\n\tquit\n\t221 2.0.0 Bye\n\tConnection closed by foreign host.\n\nYes ;)\n\n### Allow relay from an IP\n\n\ttmail relayip add IP\n\nFor example:\n\n\ttmail relayip add 127.0.0.1\n\n\n### Basic routing\n\nBy default tmail will use MX records for routing mails, but you can \"manualy\" configure alternative routing.\nIf you want tmail to route mail from @example.com to mx.slowmail.com. It is as easy as adding this routing rule\n\n\ttmail routes add -d example.com -rh mx.slowmail.com\n\nYou can find more elaborated routing rules on [tmail routing documentation (french)](http://tmail.io/doc/cli-gestion-route-smtp/) (translators are welcomed ;))\n\n### SMTP AUTH\n\nIf you want to enable relaying after SMTP AUTH for user toorop@tmail.io, just enter:\n\n\ttmail user add -r toorop@tmail.io password\n\n\nIf you want to delete user toorop@tmail.io :\n\n\ttmail user del toorop@tmail.io\n\n\n### Let's Encrypt (TLS/SSL)\n\nIf you want to activate TLS/SSL connections with a valid certificate (not an auto-signed one as it's by default) between mail clients and your tmail server you can get a let's Encrypt certificate, you have first to install let's Encrypt :\n\n\tcd ~\n\tgit clone https://github.com/letsencrypt/letsencrypt\n\tcd letsencrypt\n\nThen you can request a certificate\n\n\t./letsencrypt-auto certonly --standalone -d your.hostname\n\nYou'll have to provide a valid mail address and agree to the Let's Encrypt Term of Service. When certificate is issued you have to copy some files to the ssl/ directory\n\n\tcd /home/tmail/dist/ssl\n\tcp /etc/letsencrypt/live/your.hostname/fullchain.pem server.crt\n\tcp /etc/letsencrypt/live/your.hostname/privkey.pem server.key\n\tchown tmail.tmail server.*\n\nAnd it's done !\n\n\n## Contribute\n\nFeel free to inspect \u0026 improve tmail code, PR are welcomed ;)\n\nIf you are not a coder, you can contribute too:\n\n* install and use tmail, I need feebacks.\n\n* as you can see reading this page, english is not my native language, so I need help to write english documentation.\n\n\n## Roadmap\n\n * clustering\n * IPV6\n * write unit tests (yes i know...)\n * improve, refactor, optimize\n * test test test test\n\n\n## License\nMIT, see LICENSE\n\n\n## Imported packages\n\ngithub.com/nsqio/nsq/...\ngithub.com/codegangsta/cli\ngithub.com/codegangsta/negroni\ngithub.com/go-sql-driver/mysql\ngithub.com/jinzhu/gorm\ngithub.com/julienschmidt/httprouter\ngithub.com/kless/osutil/user/crypt/...\ngithub.com/lib/pq\ngithub.com/mattn/go-sqlite3\ngithub.com/nbio/httpcontext\ngolang.org/x/crypto/bcrypt\ngolang.org/x/crypto/blowfish\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoorop%2Ftmail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoorop%2Ftmail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoorop%2Ftmail/lists"}