파이썬 리눅스 메일 보내기
-
[Python] Linux Sendmail을 이용한 메일 보내기Python/Python for Linux 2019. 4. 13. 22:12
- OS : CentOS 7 - Python 2.7 #!/usr/bin/python from email.mine.text import MIMEText from subprocess import Popen, PIPE msg = MIMEText('Body Text') msg['Subject'] = 'Subject Text' msg['From'] = 'From Email Address' msg['To'] = 'To Email Address' p = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE) p.communicate(msg.as_string()) Step 1. sendmail install # yum install sendmailyum install sendmail se..