[問題] 發email 問題
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 = 'maXXX@gmail.com'
gmail_password = 'XXXX' # your gmail password
msg = MIMEText('content')
msg['Subject'] = 'Test'
msg['From'] = gmail_user
msg['To'] = 'XXXXX@gmail.com'
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!)
********************
--
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.163.0.31
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1528083395.A.68A.html
→
06/04 11:57,
7年前
, 1F
06/04 11:57, 1F
→
06/04 12:01,
7年前
, 2F
06/04 12:01, 2F
→
06/04 12:01,
7年前
, 3F
06/04 12:01, 3F
→
06/04 23:37,
7年前
, 4F
06/04 23:37, 4F
Python 近期熱門文章
PTT數位生活區 即時熱門文章