7 ms·
Salmon, a Python Mail Server
- mendeza 8y agoLooks interesting! What are common use cases to use this kind of library? I was thinking of using it to automate uptime of servers or exploring adding NLP to emails, but I am interested what are popular uses for this kind of a framework.
- Arkdy 8y agoTurns out that sending mail is pretty straightforward, but receiving is messy. I was evaluating it for the use case where I needed to receive emails, and then respond based on the user's position in a decision tree.
- wpietri 8y agoThat seems an odd omission, in that sending mails is easy whether or not you have a custom server.
- nickburlett 8y agoI use salmon's predecessor (lamson) to process emails for an email-driven helpdesk system. Emails come in through lamson, are processed based on headers, and either attached to the support ticket they belong to or are routed to an admin for manual processing. Lamson isn't a perfect fit for the system, but it did make it easy to get started. Unfortunately it also had a number of bugs I had to fix, since the project was defunct. I should check to see if salmon needs those fixes.
- greglindahl 8y agoThe traditional way to do this is using software like procmail -- can you comment on what lampson/salmon does better than procmail for your use-case?
- nickburlett 8y agoThe primary uses for procmail tend to be running a fixed set of rules to save mail to various directories or route it as input to scripts. My use case needs to save it to a database and make various decisions depending on the sate of the database (e.g., send notifications to anyone watching the ticket and update due dates for the support SLA). Since this database access is more efficient if the process stays connected to the database, it's better to have a long-lived process which handles mail as it comes in than to launch a new script on every incoming email. Lamson serves as both the procmail side and the script side. It's a long-running process that routes the incoming email to the appropriate business logic internally. And since it's in Python, it's easy to integrate with our existing Django database and business logic. It's not perfect, but it works well enough that I'm not actively looking for a replacement.
- greglindahl 8y agoprocmail+spamassassin is an example of a long-lived daemon and a client that talks to it, but indeed, spamassassin had to provide both parts because procmail doesn't directly do that. I have 20 year old code that does the same client/server thing, by having procmail leave files in a directory that the daemon is watching for new files to appear in. So I'd agree that it's a useful piece of sugar!
- nickburlett 8y agoI should have mentioned that I run lamson in maildir mode rather than listen on port 25. I have postfix configured to dump incoming email into a maildir, and my lamson process watches that directory. So I guess the reason I don't use procmail (aside from it not having a release since 2001) is that postfix is sufficient :->
- pecg 8y agoI can't understand the reasoning on putting everything behind HTTP these days. Personally, I think that if a project decides to go that route it's because poor design decisions. Separation of interests should exist in software solutions.
- deleted 8y ago[deleted]
- nantes 8y agoWhere does it say that it sits behind HTTP? The only bit I see that talks about something similar is, "Salmon is designed to sit _behind a traditional mail server_ in the same way a web application sits behind Apache or Nginx", emphasis is mine.
- rubinelli 8y agoIt would be nice if the documentation had some examples of how to do that, though. All it says is this: > Salmon is best deployed behind another mailserver such as Postfix or Sendmail - much in the same way as you host a WSGI application behind Apache or Nginx.
- icebraining 8y agoIf you search for "[mailserver] lmtp forward", it's not hard to find. For example, here's a configuration for Exim: https://wiki.dovecot.org/LMTP/Exim#Using_LMTP_over_TCP_Socket https://wiki.dovecot.org/LMTP/Exim#Using_LMTP_over_TCP_Socke...
- adiusmus 8y agoLots of tools for interacting with services via http. Curl, urllib, SOAP etc etc. Node.js / Python both have very good support for http. Soap etc, run a web server for quick file serving from command line if you want. Dgraoh and other tools can easily be interfaced via http. Why not leverage all that?
- dec0dedab0de 8y ago
- adiusmus 8y agoLooks interesting. I could finally automate the FAQs I receive on regular basis. Like mail filters with a template engine.
- u801e 8y agoCould Milters[1] be used to do a lot of what Salmon does? [1] https://en.wikipedia.org/wiki/Milter https://en.wikipedia.org/wiki/Milter
- zrail 8y agoYes, but milters are not much fun to write. Postfix has a way to use a sidecar MTA (like lamson/salmon) to filter. Effectively Postfix passes the mail to the external process via SMTP and then, if the process chooses to, it can re-inject the message into a queue in Postfix. I worked on a system years ago that did this for FBL reports.
- meredydd 8y agoIf you're looking for something like this, but without setting up postfix/sendmail yourself, Anvil has a pretty straightforward API (and it's already hosted on a domain): https://anvil.works/blog/email-driven-apps https://anvil.works/blog/email-driven-apps (There's a video example at that link, where I build and deploy a Mailinator-like service from scratch in a couple of minutes.)
- wpietri 8y agoFrom the page, some open-source drama: > Salmon is a fork of Lamson. [...] Lamson was relicensed under a BSD variant that was revokable. [...] I read that to mean that I could make a contribution but then have said work denied to me because the orginal author didn’t like the colour of my socks. So I went and found the latest version that was available under the GNU GPL version 3. Does anybody know the backstory here?
- deleted 8y ago[deleted]
- m_eiman 8y agoI know that Zed Shaw wrote Lamson, but I know nothing about the drama.
- dna_polymerase 8y agoI don't think there was some drama between two people involved but the creator of salmon was afraid his license of Lamson could be revoked someday, just as the license states. In order to avoid this he forked an earlier version.
- mygo 8y agogood on him. there’s not many things to fear in this world but the prospect of someone having you by the balls is definitely one of them. well, unless you’re into that
- dec0dedab0de 8y agoNo, but the clause in that license is gross. He can sue any of his users at any time if he decides he doesn't want them to be his users anymore. It's by Zed Shaw author of Learn Python the Hard Way, I'm surprised by this. In any case it looks like Lamson has not been updated since 2013. The clause: The copyright holder reserves the right to revoke this license on anyone who uses this copyrighted work at any time for any reason.
- 8y ago
- nicolaslem 8y agoIt reminds me of slimta[0], a Python framework for building Mail Transfer Agents. I used it to run some custom code to detect SPAM characteristics of incoming emails. [0] https://github.com/slimta/python-slimta https://github.com/slimta/python-slimta
- href 8y agoThank you! I want to implement an e-mail gateway for our web application that fans out e-mails to various commercial MTAs and this seems like it would be a useful building block for that.
- andris9 8y agoLots of interesting things happening in email development recently. I would compare it with ZoneMTA that is a component in WildDuck, a full featured email server written in plain node.js (https://wildduck.email https://wildduck.email)
- markovbot 8y agoWow, wildduck looks super interesting. I would try it right now if it didn't require mongodb
- lewis1028282 8y ago>Salmon is written entirely in Python and runs on Python 2.7 with experimental support for Python 3. It should hopefully run on any platform that supports Python and has Unix semantics. Why!?
- twistadias 8y ago>>Python versions supported are: 2.7, 3.5, and 3.6. From the docs
- niftylettuce 8y agoIf you need a free/encrypted/open-source email forwarding service w/o having to set anything up - see https://forwardemail.net https://forwardemail.net
- blackrock 8y agoNice, I always wanted to write a mail server. Is there any design documents? The stuff to explain the design, architecture, motivations, and intent.
- rav 8y agoI've used the GPL3 version of Lamson in the past - nice to see that someone continued development on that version in a fork. I have since switched over to aiosmtpd [1], a Python 3 based SMTP server using asyncio that was developed by Barry Warsaw and friends. [1]: https://aiosmtpd.readthedocs.io/en/latest/ https://aiosmtpd.readthedocs.io/en/latest/