-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
34 additions
and
81 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM zammad/zammad-docker-compose:zammad | ||
|
||
ENV ZAMMAD_DIR /home/zammad | ||
|
||
RUN apt-get update -qq && apt-get install -y python3 | ||
|
||
WORKDIR /smtp | ||
ADD server.py /smtp/ | ||
|
||
EXPOSE 25 | ||
|
||
CMD ["python3", "server.py"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import asyncore | ||
import os | ||
from smtpd import SMTPServer | ||
from subprocess import Popen, PIPE | ||
|
||
class ZammadServer(SMTPServer): | ||
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): | ||
print(data) | ||
pipe = Popen("bundle exec rails r 'Channel::Driver::MailStdin.new(trusted: true)'", shell=True, cwd=os.environ['ZAMMAD_DIR'], stdin=PIPE).stdin | ||
pipe.write(data.encode('utf-8')) | ||
pipe.close() | ||
|
||
def run(): | ||
serv = ZammadServer(('0.0.0.0', 25), None) | ||
try: | ||
asyncore.loop() | ||
except KeyboardInterrupt: | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
run() |