user3256707
user3256707

Reputation: 31

pipe from Python smtpd debugging server to file/database

is there a way to pipe the output from the Python smtpd debugging server

python -m smtpd -n -c DebuggingServer localhost:1025

in a database/file?

I want to show all traffic on this port on a simple webpage. If there is a better way please let me know!

Thanks for your help.

Upvotes: 3

Views: 614

Answers (1)

Miguel Ferreira
Miguel Ferreira

Reputation: 1417

I was able to send the mail content to a file by using output redirection like this:

python -m smtpd -n -c DebuggingServer localhost:1025 >> mail.txt

I would prefer to use | tee mail.txt instead of >> mail.txt (to also print the mail content to the command line) but that didn't work.

To your question, if you want to see all traffic on a specific port, you are probably looking for something like tcpdump:

tcpdump -i any port 1025

Upvotes: 1

Related Questions