티스토리 뷰
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
class cBMailer:
def __init__(self):
pass
def SendMail_BluehostTest(self):
passWd = 'PASSWORD'
userAddress = 'USERADDRESS'
smtp = smtplib.SMTP('mail.DOMAIN.net', 465)
smtp.starttls()
smtp.login(userAddress, passWd)
print('10')
testNumber = 111
msg = MIMEMultipart()
msg['Subject'] = '[테스트]Subject'+str(testNumber)
msg.attach(MIMEText('[Test]바디'+str(testNumber), 'plain'))
print("11")
fileName = "친환경+ 제조_20201229101101.xlsx"
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)
print('12')
smtp.sendmail(userAddress, 'RECEIVER', msg.as_string())
smtp.quit()
def SendMail_GmailTest(self):
passWd = 'PASSWORD'
userAddress = 'USRADDRESS'
smtp = smtplib.SMTP('smtp.gmail.com', 587)
smtp.starttls()
smtp.login(userAddress, passWd)
print('10')
testNumber = 111
msg = MIMEMultipart()
msg['Subject'] = '[테스트]Subject'+str(testNumber)
msg.attach(MIMEText('[Test]바디'+str(testNumber), 'plain'))
print("11")
fileName = "친환경+ 제조_20201229101101.xlsx"
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)
print('12')
smtp.sendmail(userAddress, 'RECEIVER', msg.as_string())
smtp.quit()
반응형
'SWDesk > Firmware' 카테고리의 다른 글
Arduino + JSON + Web Communication (1) | 2021.06.03 |
---|---|
ArduinoJson 테스트 (0) | 2021.02.12 |
HC-05, 블루투스 통신 모듈 (0) | 2020.12.20 |
[Arduino] JSON 예제 (0) | 2020.11.25 |
[BPM] Firmware Source for Master (0) | 2020.07.19 |
반응형
250x250
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 전압
- 빌리언트
- ServantClock
- Innovation&Hurdles
- 허들
- 티스토리챌린지
- bilient
- 혁신
- 전류
- badp
- 배프
- image
- 절연형
- 둎
- 심심풀이치매방지기
- 전압전류모니터링
- Decorator
- BSC
- Innovations
- 혁신과허들
- 치매방지
- Hurdles
- DYOV
- arduino
- 오블완
- Video
- 심심풀이
- 아두이노
- Innovations&Hurdles
- 치매
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함