1
發送smtplib發送一個空白主體的問題,即使該值將打印到控制檯就好。Python smtplib空白消息
父類的方法:
recipient = '[email protected]'
text = 'Subject: Employee Departure Notification.\n%s has left Redcated. Their termination is effective %s.' % (employee_name, text)
print('SMTP text: ', text)
message = smtpObj.sendmail(config['Email']['username'], recipient, text)
這工作得很好用的代碼,這部分:
if
i['request_variables'][4]['value'] == 'Immediately':
text = 'their termination is effective immediately'
但是,儘管它打印正確的邏輯來安慰(毛坯體,但電子郵件不具有以下工作否則發送)
last_day_long = datetime.strptime(last_day, '%Y-%m-%d') + timedelta(hours=17)
last_day = str(last_day_long)
text = 'their termination is effective %s at 5:00pm' % last_day
print('Last day value before email: ', last_day)
請忽略我可怕的代碼和格式,a預先提供任何幫助!