Example #1
0
 def post(self, id):
     zsite = Zsite.mc_get(id)
     title = self.get_argument('title', '')
     txt = self.get_argument('txt', '')
     if zsite and title and txt:
         mail = mail_by_user_id(id)
         name = zsite.name
         sendmail(title, txt, mail, name, ADMIN_MAIL)
     self.redirect('/zsite/%s' % id)
Example #2
0
def vps_new(_id, user_id, ip, ssh_port, passwd):
    username = '******'%_id
    mail = mail_by_user_id(user_id)

#    return
    if _id != 149:
        return
    print 'echo %s:%s| chpasswd'%(username, passwd)
    print mail
    print ""
#    subject = "[42qu.培训班] 下节课的预习材料"
#    text = """
#
#上节课的讲义
#http://book.42qu.com/linux/vim.html
#
#下节课的预习
#
#版本控制
#http://book.42qu.com/tool/hg.html
#http://book.42qu.com/tool/git.html
#
#数据库
#http://book.42qu.com/database/index.html
#
#PS: 没有开通主机的同学 请邮件到我邮箱 [email protected] 标题为 "[主机.42培训班] + 你的42qu注册帐号"
#
#另外请加入
#Google groups https://groups.google.com/group/42qu-school
#QQ群 : 211707205
#"""


    subject = '[42qu.培训班] 学习用的主机帐号'
    text = """
主机 : 0002.42qu.us
用户名 : %s
密码 : %s

如何登录主机
http://book.42qu.com/linux/introduction.html

预习材料:
http://book.42qu.com/python/before_started.html

Google groups https://groups.google.com/group/42qu-school
QQ群 : 211707205
    """%(username, passwd)

    mail = "*****@*****.**"
    #mail = '*****@*****.**'
    print subject
    print text
    sendmail(
        subject,
        text, mail
    )
def main():
    cursor = cursor_by_table("failed_mq")
    now = datetime.datetime.now().strftime("%Y%m%d")
    cursor.execute("select id,body,exc,func,time from failed_mq where time>%s" % str(int(now)))

    out = []
    for id, body, exc, func, ctime in cursor.fetchall():
        out.append("---------Traceback----------\n")
        out.append(exc)
        out.append("\n--------function----------\n")
        out.append(func)
        out.append("\n-----------time-----------\n")
        out.append(ctime)
        out.append("\n******************************\n")

    if out:
        sendmail("42qu.com failed mq %s" % now, "".join(out), MQ_FAIL_MAIL_ADDR, name="failed_mq")
Example #4
0
def vps_open_mail(mail, group, user, passwd):
    host = 'e%s.42qu.us'%group
    subject = 'VPS已开通 : 帐号 %s 主机 %s'%( user, host)
    txt = Template(u"""

本主机仅供 42qu.com 以及 其开源代码 感兴趣的人 研究学习 , 请不要用于其他用途 

主机 : ${host}
用户 : ${user}
密码 : ${passwd}

开发测试的域名 : ${user}e${group}.tk (请参阅 文档2 配置开发域名)

文档 :

1 . 用xshell登录服务器 http://book.42qu.com/linux/xshell.html

2 . 运行42qu.com开源代码 http://book.42qu.com/42qu/newbie.html


数据库 : 

用户名 zpage, 密码 42qudev 

注意  : zpage 和 zpage_google 的共用的开发数据库 , 请不要乱动 

你可以创建自己的 zpage_随便取名字 数据库玩

管理后台 : http://e1sql.42qu.us/

有任何问题请到这里提问 :

https://groups.google.com/group/42qu-school

""").render(
host=host,
user=user,
passwd=passwd,
group=group
)
    sendmail(subject, txt, mail)
    mail = "*****@*****.**"
    sendmail(subject, txt, mail)
Example #5
0
def vps_open_mail(mail, group, user, passwd):
    host = 'e%s.42qu.us' % group
    subject = 'VPS已开通 : 帐号 %s 主机 %s' % (user, host)
    txt = Template(u"""

本主机仅供 42qu.com 以及 其开源代码 感兴趣的人 研究学习 , 请不要用于其他用途 

主机 : ${host}
用户 : ${user}
密码 : ${passwd}

开发测试的域名 : ${user}e${group}.tk (请参阅 文档2 配置开发域名)

文档 :

1 . 用xshell登录服务器 http://book.42qu.com/linux/xshell.html

2 . 运行42qu.com开源代码 http://book.42qu.com/42qu/newbie.html


数据库 : 

用户名 zpage, 密码 42qudev 

注意  : zpage 和 zpage_google 的共用的开发数据库 , 请不要乱动 

你可以创建自己的 zpage_随便取名字 数据库玩

管理后台 : http://e1sql.42qu.us/

有任何问题请到这里提问 :

https://groups.google.com/group/42qu-school

""").render(host=host, user=user, passwd=passwd, group=group)
    sendmail(subject, txt, mail)
    mail = "*****@*****.**"
    sendmail(subject, txt, mail)