[問題] 發email 問題

作者: materies (說)   2018-06-04 11:36:31
Traceback (most recent call last):
File "test_7.py", line 28, in <module>
server.send_message(msg)
AttributeError: SMTP_SSL instance has no attribute 'send_message'
請問這error 要如何解
謝謝
附上程式碼
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
from PIL import Image #讀取#
import numpy as np
import matplotlib.pyplot as plt
import gmpy2
import smtplib
from email.mime.text import MIMEText
gmail_user = '[email protected]'
gmail_password = 'XXXX' # your gmail password
msg = MIMEText('content')
msg['Subject'] = 'Test'
msg['From'] = gmail_user
msg['To'] = '[email protected]'
server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
server.ehlo()
server.login(gmail_user, gmail_password)
server.send_message(msg)
server.quit()
print('Email sent!)
********************
作者: kobe8112 (小B)   2018-06-04 11:57:00
沒有send_message這個函式可以讓你呼叫你可能需要確認你的模組版本到底有哪些函式可以用或者直接試試/google sendmail這個函式
作者: materies (說)   2018-06-04 23:37:00
感謝 已經解決

Links booklink

Contact Us: admin [ a t ] ucptt.com