def send2others(host, pending_info, action_info): try: user_info, acc_info = getInfo(pending_info['action_id'], ACCOUNT_TABLE[host]) title, content = split_content(pending_info['content']) smtp = SmtpClient(acc_info['username'], acc_info['password'], host) smtp.send(acc_info['username'], [action_info['destination']], title, content) return True except: print_exc() return False
def send2me(pending_info, action_info, acc_table): ''' send an email to user from our account ''' try: user_info, acc_info = getInfo(pending_info['action_id'], acc_table) title, content = split_content(pending_info['content']) smtp = SmtpClient(SMTP_ACC, ACC_PWD, 'smtp.163.com') smtp.send(SMTP_ACC, [acc_info['username']], title, content) return True except: print_exc() return False