Skip to content

Commit

Permalink
revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Brenton Morris committed Nov 6, 2017
1 parent 12d1654 commit f666010
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 9 deletions.
18 changes: 18 additions & 0 deletions docker-compose.yml
@@ -1,9 +1,27 @@
version: '3.1'
services:
smtpd:
build: ./smtpd
ports:
- "8025:8025"
web:
build: ./web
ports:
- "5000:5000"
mongodb:
image: "mvertes/alpine-mongo"
restart: always
ports:
- "27017:27017"
volumes:
- ./data/mongo:/data/db
postgres:
image: "postgres:9.2-alpine"
# restart: always
ports:
- "5432:5432"
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment:
PGDATA: /var/lib/postgresql/data/pgdata

6 changes: 6 additions & 0 deletions smtpd/Dockerfile
@@ -0,0 +1,6 @@
FROM python:3.6
ADD ./src /smtpd
WORKDIR /smtpd
RUN pip install -r requirements.txt
CMD python app.py

17 changes: 9 additions & 8 deletions smtpd/app.py → smtpd/src/app.py
Expand Up @@ -13,21 +13,22 @@

class MailHandler:
async def handle_DATA(self, server, session, envelope):
print('Message from %s' % envelope.mail_from)
print('Message for %s' % envelope.rcpt_tos)
print('Message data:\n')
print(envelope.content.decode('utf8', errors='replace'))
print('End of message')

# parse attachments
# parse message
message = email.message_from_string(envelope.content.decode('utf8', errors='replace'))
i = 0
if message.is_multipart():
for part in message.walk():
print('PART {}'.format(i))
i += 1
print(part)
print('-' * 80)


return '250 Message accepted for delivery'


async def amain(loop):
cont = Controller(MailHandler(), hostname='::0', port=8025)
cont = Controller(MailHandler(), hostname='0.0.0.0', port=8025)
cont.start()


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion web/Dockerfile
@@ -1,4 +1,4 @@
FROM python:3.4-alpine
FROM python:3.6
ADD ./src /sarlacc
WORKDIR /sarlacc
RUN pip install -r requirements.txt
Expand Down

0 comments on commit f666010

Please sign in to comment.