- 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 sendmail-cf
|
Step 2. edit /etc/mail/sendmail.mc
52 line "dnl" remove
53 line "dnl" remove
118 line "dnl" remove
Step 3. Service Start
# systemctl start sendmail
|
'Python > Python for Linux' 카테고리의 다른 글
[ Python ] 리눅스 mpstat 유틸을 이용한 CPU Core별 통계 뽑기. (평균값, 최대값, 최소값) (0) | 2023.05.14 |
---|---|
[Python] Obtain capacity for Linux specific folder capacity. (리눅스 특정 확장자 용량 구하기) (0) | 2019.10.25 |
[Python] pandas를 이용한 tomcat accesslog 분석 및 활용 (0) | 2019.09.05 |
[Python] Linux에서 간단한 Web 모니터링 하기 (0) | 2019.04.15 |
[ CentOS ] Python pip install (0) | 2019.04.13 |
[Python] linux ping check(ICMP) program (0) | 2019.04.09 |
[Python] CentOS 7 Python3 Install and Symbolc link (0) | 2019.03.28 |
[Python] Linux 디렉토리와 파일 리포팅 (0) | 2019.03.27 |