Commit ba077555 authored by ale's avatar ale
Browse files

Add a sendmail script that talks to a remote SMTP server

parent 4b742ffc
......@@ -4,6 +4,7 @@ COPY conf /tmp/conf
COPY /tmp/
COPY apply-forced-params /usr/local/bin/apply-forced-params
COPY /usr/sbin/sendmail
RUN /tmp/ && rm -fr /tmp/ /tmp/conf
ENTRYPOINT ["/usr/local/bin/chaperone"]
# Send an email sent from stdin using a remote SMTP server.
# Behaves similarly to /usr/sbin/sendmail (sort of).
import optparse
import sys
import smtplib
parser = optparse.OptionParser()
parser.add_option('-i', dest='ignored', action='sore_true')
parser.add_option('-f', dest='from_addr', default='nobody')
parser.add_option('--server', dest='server', default='localhost')
parser.add_option('--port', dest='server_port', type='int', default=25)
opts, args = parser.parse_args()
if not args:
raise Exception('Not enough arguments')
msg =
s = smtplib.SMTP(opts.server, opts.server_port)
s.sendmail(opts.from_addr, args, msg)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment