]>
git.ipfire.org Git - ipfire.org.git/blob - src/web/newsletter.py
10 class SubscribeHandler(base
.BaseHandler
):
11 @tornado.gen
.coroutine
13 address
= self
.get_argument("email")
15 # Create an email with us as sender
16 m
= email
.mime
.text
.MIMEText("")
17 m
.add_header("To", "ipfire-announce-join@lists.ipfire.org")
18 m
.add_header("From", address
)
19 m
.add_header("Sender", "no-reply@ipfire.org")
20 m
.add_header("Subject", "Subscribe")
22 logging
.debug("Sending email:\n%s" % m
.as_string())
25 p
= tornado
.process
.Subprocess(["sendmail", "-t"],
26 stdin
=tornado
.process
.Subprocess
.STREAM
)
28 # Pipe the email into sendmail
29 yield tornado
.gen
.Task(p
.stdin
.write
, m
.as_bytes())
31 # Close standard input
34 # Wait until sendmail is done
35 ret
= yield p
.wait_for_exit()
37 logging
.info("%s has subscribed to the newsletter" % address
)
39 self
.render("newsletter/subscribed.html", address
=address
)