另一个程序发送到我的脚本已经完成的信:
所以,我解析from_email
和to_email
,在文本中做一些更改,并用mailjet发送它。在
当我使用smtp
进行此操作时:
def send(sender, to, message):
smtp = smtplib.SMTP(SERVER, PORT)
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
smtp.login(USER,PASSWORD)
logger.info('Sending email from %s to %s' % (sender, to))
smtp.sendmail(sender, to, message)
logger.info('Done')
smtp.quit()
效果很好。然后我需要使用mailjet
。我创建了类似的函数:
但我收到的是短信,不是邮箱里的附件。在
您应该使用官方的Mailjet包装器,它是Mailjet维护的API客户机。如文档中所述,以下是发送附件的方法:http://dev.mailjet.com/guides/?python#sending-with-attached-files
相关问题 更多 >
编程相关推荐