-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'no_html_in_plain_mail' into develop
- Loading branch information
Showing
24 changed files
with
239 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,9 +126,6 @@ services: | |
dev: | ||
aliases: | ||
ports: | ||
- "5005:5005" | ||
- "5006:5006" | ||
|
||
volumes: | ||
home: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
FROM golang:rc-alpine | ||
RUN apk add --no-cache git | ||
RUN apk add --no-cache gcc | ||
RUN apk add --no-cache musl-dev | ||
RUN git clone "https://github.com/jamillosantos/mailslurper.git" /opt/mailslurper | ||
WORKDIR /opt/mailslurper/cmd/mailslurper | ||
RUN go get github.com/mjibson/esc | ||
RUN cd /opt/mailslurper/cmd/mailslurper | ||
COPY ./mailslurper.conf config.json | ||
RUN go get | ||
RUN go generate | ||
RUN go build | ||
ENTRYPOINT ["/opt/mailslurper/cmd/mailslurper/mailslurper"] | ||
FROM debian:stable-slim | ||
|
||
RUN apt-get update && apt-get install -y python3 python3-aiosmtpd python3-termcolor | ||
|
||
WORKDIR /opt/mail | ||
COPY mail.py mail.py | ||
|
||
ENTRYPOINT ["python3", "mail.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import asyncio | ||
import email | ||
import email.policy | ||
import sys | ||
|
||
from aiosmtpd.controller import Controller | ||
from termcolor import cprint | ||
|
||
|
||
class PycroftDebugging: | ||
COLOR_HEADER = "blue" | ||
COLOR_CONTENT_BORDER = "magenta" | ||
|
||
async def handle_DATA(self, server, session, envelope): | ||
message = email.message_from_bytes(envelope.content, policy=email.policy.default) | ||
|
||
# Print headers | ||
for key, value in message.items(): | ||
cprint(f"{key}: {value}", self.COLOR_HEADER) | ||
|
||
# Print message parts, i.e. text/plain, text/html | ||
for part in message.walk(): | ||
try: | ||
content = part.get_content() | ||
except KeyError: | ||
continue | ||
|
||
print() | ||
content_type = part.get_content_type() | ||
cprint(content_type, self.COLOR_CONTENT_BORDER) | ||
cprint("⌄" * len(content_type), self.COLOR_CONTENT_BORDER) | ||
print(content) | ||
cprint("⌃" * len(content_type), self.COLOR_CONTENT_BORDER) | ||
|
||
print() | ||
sys.stdout.flush() | ||
|
||
return "250 Message accepted for delivery" | ||
|
||
|
||
controller = Controller(PycroftDebugging(), hostname="0.0.0.0", port=2500) | ||
controller.start() | ||
|
||
loop = asyncio.get_event_loop() | ||
try: | ||
loop.run_forever() | ||
finally: | ||
loop.close() | ||
controller.stop() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{%- set links = [] -%} | ||
{%- import "macros/link.html" as link with context -%} | ||
{%- if mode == 'html' -%} | ||
<pre> | ||
{% endif %} | ||
{%- block body -%}{%- endblock -%} | ||
|
||
{{ link.render_link_list() }} | ||
{%- if mode == 'html' -%} | ||
</pre> | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.