-
Notifications
You must be signed in to change notification settings - Fork 0
/
send_invites.py
49 lines (35 loc) · 1.26 KB
/
send_invites.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python
import smtplib
import db
import github
import settings
def send_invite(username):
user = github.user_info(username)
if not user.get("email", None):
print "No public email: " + username
return
first_name, _, _ = (user["name"] or "").partition(" ")
if len(first_name) < 2:
first_name = username
message = """From: Mike Dirolf <[email protected]>
To: %s
Subject: Welcome to Gitlists
Content-Type: text/plain
Hi %s,
Thanks for signing up for Gitlists. Gitlists is a simple way to communicate about your GitHub projects. You can give it a try here:
https://gitlists.com
We love feedback; this is my personal address so please reply with any questions, feedback, or suggestions.
Hope you're having a great day,
Mike
P.S. Gitlists is also open source. If you want to hack on it:
https://github.com/fiesta/gitlists
""" % (user["email"], first_name)
smtp = smtplib.SMTP(settings.relay_host, settings.relay_port)
smtp.sendmail("[email protected]", [user["email"]], message)
smtp.quit()
if __name__ == "__main__":
for x in list(db.db.beta.find({"invited": {"$exists": False}})):
x["invited"] = True
db.db.beta.save(x)
print "inviting", x["gh"]
send_invite(x["gh"])