Yagmail将邮件加密到base 64中

2024-05-23 17:32:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我发送了一封包含以下python代码的电子邮件:

import yagmail, sha, sys, os
os.system('stty -echo')
password = raw_input('Gmail password: ')
os.system('stty echo')
print ''
if not sha.sha(password).hexdigest() == 'digest_of_the_password':
    print 'Password Declined'
    sys.exit()
yag = yagmail.Connect('me@gmail.com', password)
yag.send('to@example.com', 'Hi', "G'day")

主题是“嗨”,但身体是“RydkYXk=”。我在mac终端上用命令sudo pip install yagmail安装了yagmail。你知道吗

如何修复此错误?你知道吗


Tags: 代码importechocomrawos电子邮件sys
1条回答
网友
1楼 · 发布于 2024-05-23 17:32:50

作为维修人员我非常抱歉!你知道吗

我不小心在错误的行中添加了一个制表符,这也给文本添加了base64编码!你知道吗

如果您现在使用sudo pip install -U yagmail,它将升级到解决此问题的新版本。你知道吗

对于将来的bug,请将它们归档到github,我将尝试在发布后24小时内解决所有问题。你知道吗

请注意,现在您可以简单地省略密码:在提示您输入一次密码后,它会将其安全地保存在keyring中。在这种情况下,这样可以节省很多行:

import yagmail
yag = yagmail.SMTP('me@gmail.com')
yag.send('to@example.com', 'Hi', "G'day")

相关问题 更多 >