<模块>服务器中的文件“ C:/PycharmProjects/eskunemlogger/eskunemlogger.pyw”,行33 = smtplib.SMTP('smtp.gmail.com',587)

时间:2018-10-16 16:51:08

标签: python email sendmail

因此,我正试图做成一个电子邮件发件人,只是为了好玩。它无法解码某处的内容,但我找不到错误,我将感谢您的任何帮助。我像3-4个月前一样开始使用Python,所以如果您想知道为什么我找不到它,那是为什么。我将不胜感激任何帮助。谢谢:)

这是我的代码:

In [35]: df = pd.DataFrame(np.random.randint(0, 2, (1000, 1000)))

In [36]: %timeit pd.DataFrame(justify(df[df.cummax(1).ne(0)].values, invalid_val=np.nan, axis=1, side='left')).fillna(0).a
    ...: stype(int)
116 ms ± 640 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [37]: %%timeit
    ...: a = df.values
    ...: s = a.argmax(1) * - 1
    ...: m, n = a.shape
    ...: r, c = np.ogrid[:m, :n]
    ...: s[s < 0] += n
    ...: c = c - s[:, None]
    ...: pd.DataFrame(a[r, c])
    ...:
    ...:
11.3 ms ± 18.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

错误是:

import stuff

emailfelhasz = 'mail'
emailjelsz = 'passwrd'
emailfelhkuld = 'mail'

targy = 'logok sulibol lenny'

msg = MIMEMultipart()
msg['From'] = emailfelhasz
msg['To'] = emailfelhkuld
msg['Subject'] = targy

body = 'Ujabb log'
msg.attach(MIMEText(body, 'plain'))

filename = 'log.txt'
attachment = open(filename, 'rb')

part = MIMEBase('application', 'octet-stream')
part.set_payload((attachment).read())
encoders.encode_base64(part)
part.add_header('Content-Disposition', "attachment; filename= "+filename)

msg.attach(part)
text = msg.as_string()
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login(emailfelhasz, emailjelsz)
print("Sikeres belépés")

for i in range(0, 20):
    server.sendmail(emailfelhasz, emailfelhkuld, text)
    print("Email elküldve")

server.quit()

0 个答案:

没有答案