Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smptd custom server example seems to be missing kwargs #2

Open
joaduo opened this issue Dec 18, 2020 · 0 comments
Open

smptd custom server example seems to be missing kwargs #2

joaduo opened this issue Dec 18, 2020 · 0 comments

Comments

@joaduo
Copy link

joaduo commented Dec 18, 2020

I tried to run your custom server example but then i had to fix it like:

    import smtpd
    import asyncore
    
    
    class CustomSMTPServer(smtpd.SMTPServer):
    
        def process_message(self, peer, mailfrom, rcpttos, data, **options):
            print('Receiving message from:', peer)
            print('Message addressed from:', mailfrom)
            print('Message addressed to  :', rcpttos)
            print('Message length        :', len(data))
            print('Message options        :', options)
            print('Message data        :', data)
    
    
    server = CustomSMTPServer(('127.0.0.1', 1025), None)
    
    asyncore.loop()

Adding the missing **kwargs (**options in the example above) makes the server work again. Here my setup:

    $ python3 --version
    Python 3.8.5
    $ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"

def process_message(self, peer, mailfrom, rcpttos, data):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant