else:
k = template, subject = MAILTEMPLATES["languages"][""][emailtype]
- return k["body"] % obj, k["subject"] % obj
+ return k["body"] % obj, k["subject"] % obj, MAILTEMPLATES["sendto"].setdefault(emailtype)
def email(userid, emailtype, prevemail):
cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
else:
language = ""
- template, subject = processtemplate(emailtype, language, unifieddict)
+ template, subject, mailto = processtemplate(emailtype, language, unifieddict)
+ if not mailto:
+ mailto = "user.email"
+
print "%s -> %s" % (`subject`, `unifieddict["user.email"]`)
- inject(unifieddict["user.email"], subject, template)
+ inject(unifieddict[mailto], subject, template)
def main():
ignoring = {}
"conn": "dbname='q9' user='' password=''",
"smtphost": "localhost",
"smtpauth": None,
+ "templateoptions": {
+ "bot": "Q9",
+ "cleanup": 80,
+ "securityurl": "http://www.quakenet.org/faq/faq.php?c=160",
+ "siteurl": "http://www.quakenet.org/",
+ "server": "CServe.test.quakenet.org",
+ },
"from": "q9@quakenet.org",
"defaultlang": "en",
"url": "http://webdev.quakenet.org/~slug/q9dev/",
"mutators": {
1: generate_url,
},
-
+ "sendto": {
+ 5: "prevemail",
+ },
"languages": {
"en": {
1: {
- "subject": "New account registration",
+ "subject": "%(config.bot)s account registration",
"body": """
Thank you for registering.
To get your password please visit:
%(url)s
In case you forget your login/password use:
-/msg %(config.bot)s REQUESTPASSWORD %(user)s %(user.email)s
+/msg %(config.bot)s REQUESTPASSWORD %(user.username)s %(user.email)s
-Make sure you've read the %(config.bot)s FAQ FAQ at http://www.quakenet.org for a complete
+Make sure you've read the %(config.bot)s FAQ at %(config.siteurl)s for a complete
reference on Q's commands and usage.
- ** PLEASE READ http://www.quakenet.org/faq/faq.php?c=160 --
+ ** PLEASE READ %(config.securityurl)s --
it contains important information about keeping your account secure.
Note that QuakeNet Operators will not intervene if you fail to read
the above URL and your account is compromised as a result.
NB: Save this email for future reference.
""",
},
- 2: { "subject": "Password request", "body": "Your password: %(user.password)s", },
- 3: { "subject": "New password", "body": "Your new password: %(user.password)s", },
- 5: { "subject": "Email change", "body": "Your old email address: %(prevemail)s", },
+ 2: { "subject": "%(config.bot)s password request", "body": """
+Your username/password is:
+
+Username: %(user.username)s
+Password: %(user.password)s
+
+To auth yourself to %(config.bot)s, type the following command
+
+ /MSG %(config.bot)s@%(config.server)s AUTH %(user.username)s %(user.password)s
+""", },
+ 3: { "subject": "%(config.bot)s password change", "body": "Your new password: %(user.password)s", },
+ 5: { "subject": "%(config.bot)s email change", "body": """
+Your email address has been changed on %(config.bot)s.
+
+ADD RESET STUFF,
+
+blah %(user.email)s
+""", },
},
},
}