LoginSignup
0
1

More than 3 years have passed since last update.

PythonでGmailを送りたいけどエラーで無理

Posted at

今日は朝からPythonのオンライン講座に登録しました。
有料コンテンツに入ってすぐ理解不能。

「PythonでGmailを送る」

え??そんなんできんの?

でも私はできない。

from email import message
import smtplib
smtp_host = 'smtp.gmail.com'
smtp_port = 587
from_email = '送る人のアドレス'
to_email = '送りたい相手のアドレス'
username = '自分のアドレス'
password = 'パスワード'
msg = message.EmailMessage()
msg.set_content('test mail')
msg['Subject'] = 'test mail(sub)'
msg['From'] = from_email
msg['To'] = to_email
server = smtplib.SMTP(smtp_host, smtp_port)
server.ehlo()
server.starttls()
server.ehlo()
server.login(username, password)
server.send_message(msg)
server.quit()

エラーの文章も載せたいけど、どれが個人情報かわからないので載せれません…
p=WantAuthError
最後に書かれているこれが気になるけど検索しても出てこない…
なんでかな。。。。
分かる方いましたらアドバイスお願いします!!!!

あきらめない

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1