def main(args): print args global content param_count = len(args) if param_count < 2: print 'do not have email params' return if param_count < 3: print 'do not have content words' return to_mail_list = args[2].split(',') mail = Mail() mail.set_to_list(to_mail_list) mail.set_subject("热词") mail.send_text_mail(content)
def main(args): """["attachment_mail.py", "*****@*****.**", "1.txt", "this is a test args"]""" param_count = len(args) filename = '' content = '' if param_count == 1: print 'do not have email params' return if param_count == 2: print 'do not have attachments params' return if param_count >= 3: """file path""" filename = args[2] if not os.path.exists(filename): print 'dattachments not exist' return if param_count == 4: content = args[3] to_mail_list = args[1].split(',') mail = Mail() mail.set_to_list(to_mail_list) mail.set_subject("详情") mail.send_attachment(content, filename)