]>
git.ipfire.org Git - ipfire.org.git/blob - src/web/newsletter.py
10 class SubscribeHandler(base
.BaseHandler
):
13 # Makes sure that we call blacklist for everything
16 @tornado.gen
.coroutine
18 address
= self
.get_argument("email")
20 # Create an email with us as sender
21 m
= email
.mime
.text
.MIMEText("")
22 m
.add_header("To", "ipfire-announce-join@lists.ipfire.org")
23 m
.add_header("From", address
)
24 m
.add_header("Sender", "no-reply@ipfire.org")
25 m
.add_header("Subject", "Subscribe")
27 logging
.debug("Sending email:\n%s" % m
.as_string())
30 p
= tornado
.process
.Subprocess(["sendmail", "-t"],
31 stdin
=tornado
.process
.Subprocess
.STREAM
)
33 # Pipe the email into sendmail
34 yield tornado
.gen
.Task(p
.stdin
.write
, m
.as_bytes())
36 # Close standard input
39 # Wait until sendmail is done
40 ret
= yield p
.wait_for_exit()
42 logging
.info("%s has subscribed to the newsletter" % address
)
44 self
.render("newsletter/subscribed.html", address
=address
)