Giter Site home page Giter Site logo

crustymonkey / python-libmilter Goto Github PK

View Code? Open in Web Editor NEW
25.0 8.0 20.0 56 KB

A pure python implementation of libmilter. This is compatible with both Postfix and Sendmail.

Home Page: http://stuffivelearned.org/doku.php?id=programming:python:python-libmilter

License: GNU Lesser General Public License v3.0

Python 100.00%

python-libmilter's Introduction

python-libmilter

NO LONGER SUPPORTING

I'm no longer supporting this module at this time. I will accept pull requests for fixes, but I'm no longer actively working on this project (and haven't for quite some time). I haven't maintained mail servers in about 8 years (at the time of this addition), and therefore I don't have a great way of testing this module. Again, I will continue to take pull requests for changes for this.

Python3 only

As of 2.0, this is Python 3 only. You can manually pick an older commit for Python 2, but you really shouldn't be using Python 2 as it EOL years ago.

INSTALL

  1. If you have a .tar.gz, extract that first.

    tar -xvzf python-libmilter*.tar.gz

  2. Now, just cd into the directory and install it

    cd python-libmilter* python setup.py install

That's it, that will install the the libmilter.py file into its proper place. Do note that you can just drop libmilter.py into your project folder and use it that way too. The whole point of this project is to maximize portability.

You can also install libmilter (python 2 version) using pip or easy_install

pip install python-libmilter

EXAMPLES

See the basic ForkFactory example in the "examples" directory.

DOCUMENTATION

Please see my wiki site for all the documentation on this library.

POSTFIX INTEGRATION

Edit the main.cf configuration file with the following parameters and values:

milter_default_action = accept
smtpd_milters = inet:127.0.0.1:5000
non_smtpd_milters = inet:127.0.0.1:5000
milter_protocol = 6
milter_mail_macros = i {mail_addr} {client_addr} {client_name} {auth_authen} {auth_type}

ISSUES

Please open a ticket on github if you encounter any issues or you have feature requests.

CODE CONTRIBUTIONS

Please use the the "fork" and "pull request" mechanisms built into Github if you wish to contribute code to the project.

python-libmilter's People

Contributors

christophlsa avatar crustymonkey avatar danbla avatar danblad avatar diciu avatar dotpy avatar joshdata avatar kaktus42 avatar moparisthebest avatar pavinjosdev avatar wesselt 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-libmilter's Issues

Callback return value after setReply()

Hi and thanks a lot for this module!
I'm not sure if this is an issue or I'm just missing something.

When using setReply() in a callback (e.g. eob()), what should I return?
If I return libmilter.REJECT, like:

self.setReply(b'550', b'5.7.1', b'Service unavailable')   # Sends a 'y' packet
return libmilter.REJECT                                   # Sends a 'r' packet

the milter will send two replies to the MTA (reply AND reject).

This double reply is generating quite a few issues to me when the email client doesn't close the connection and keeps sending emails over the same connection: the MTA (Postfix) thinks the second reply actually comes from the next callback, ending up in a kind of "desync" between MTA calls and milter replies.

I found a workaround (but I'm not sure if it's a workaround or the right thing to do), which is returning a Deferred() instance instead of REJECT, e.g.:

self.setReply(b'550', b'5.7.1', b'Service unavailable')
return libmilter.Deferred()

I hope my description is not too messy...
So my question is: what is the correct value to return after setReply()? Is it REJECT, than there's an issue in the module, or Deferred(), than it's ok, but maybe the documentation should be more explicit on this point...

Thanks a lot in advance for your help!
Cheers,
Daniele

No Python 3 support in the pypi release

I tried to use python-libmilter in my Python3-based project, but the version installed with PIP would not work with Python 3 (fails on old 'except' syntax).

I can see there is a 'python3' branch here (and it seems to work alright), it is a pity PyPI still only provides package for the old Python.

New release ?

Could you release latest master ? I am writing a milter which relies on rcpt-to values being correct, so the latest merged request (#6) fixes a killer issue.

can't connect the testmilter with postfix

I started the milter (running)
I enabled the milter in the postfix config:

milter_protocol = 6
milter_default_action = accept
smtpd_milters = tcp:127.0.0.1:5000 unix:/var/run/opendkim/opendkim.sock
non_smtpd_milters = tcp:127.0.0.1:5000 unix:/var/run/opendkim/opendkim.sock

Thus, the testmilter should be called before the opendkim milter.

However, I don't get any log from the testmilter when I send an email.
Why is that?

AsyncFactory

Hello,
I noticed that the example set, testmilter.py when changed to AsyncFactory, the application uses immediately, without any connection, 4% of CPU. This is expected?

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.