email 配置:
SERVER_EMAIL = "server@%s" % HOST
EMAIL_HOST = "localhost"
EMAIL_PORT = 25
EMAIL_HOST_USER = "server@duitang.com"
DEFAULT_FROM_EMAIL = u'堆糖网 <server@duitang.com>'
25对应的 /usr/libexec/postfix/master
def sendEmail2(addresses, title, content, from_email=u"网站台 <no-reply@zhangyutai.com>"):"发送邮件方法"if type(addresses) in (types.StringType, types.UnicodeType):addresses = (addresses,)addr_list = []for addr in addresses:if addr not in addr_list:addr_list.append(addr)try:msg = EmailMessage(title, content, from_email or DEFAULT_FROM_EMAIL, addr_list)msg.content_subtype = "html"msg.send()return Trueexcept Exception, e:return False