Copernicus
Copernicus

Reputation: 291

Python SMTP Server Not Receiving Emails

I've tried running a simple python SMTP server but for some reason it won't receive any incoming emails when I send it to the server. I'm using the following code from https://pymotw.com/2/smtpd/index.html:

import smtpd
import asyncore

class CustomSMTPServer(smtpd.SMTPServer):

    def process_message(self, peer, mailfrom, rcpttos, data):
        print 'Receiving message from:', peer
        print 'Message addressed from:', mailfrom
        print 'Message addressed to  :', rcpttos
        print 'Message length        :', len(data)
        return

server = CustomSMTPServer(('127.0.0.1', 25), None)

asyncore.loop()

And I'm running the script with: sudo python simpleSmtpServer.py

A few notes:

Is there anything I'm missing with this code or maybe some DNS configurations that I need to update?

Upvotes: 3

Views: 837

Answers (1)

Copernicus
Copernicus

Reputation: 291

@furas had the answer. Changing the address to 0.0.0.0 fixed the problem.

Upvotes: 4

Related Questions