Gmail의 경우 보안서비스를 해제해야 가능


import smtplib from email.mime.text import MIMEText senderAddr = "보내는메일" recipientAddr = "받는메일" text = "본문 test 파이썬" msg = MIMEText(text,_charset="utf8") msg['Subject'] = "smtp 테스트 Hello!" msg['From'] = senderAddr msg['to'] = recipientAddr s=smtplib.SMTP_SSL('smtp.gmail.com',465) s.login("보내는 메일주소","비밀번호") s.sendmail(senderAddr,recipientAddr,msg.as_string()) print("메일보내기 성공") s.quit()


'먼지 낀 책장사이 > Python' 카테고리의 다른 글

테이블 제작, 데이터입력  (0) 2016.11.08
SQLite  (0) 2016.10.18
쓰레드  (0) 2016.10.11
상속, 오버라이딩, 툴킷  (0) 2016.09.27
Raw파일 읽기, 클래스, 생성자  (0) 2016.09.20