main.py
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
return
#server = CustomSMTPServer(('127.0.0.1', 1025), None)
server = CustomSMTPServer(('192.168.0.100', 1025), None)
asyncore.loop()
python main.py
設定 Jenkins 使用 local 端的 smtp mail sever
- Manage Jenkins-> Configure System
- E-mail Notification
SMTP server 192.168.0.100
SMTP Port 1025
- 管理 Jenkins
- 設定系統
電子郵件通知
SMTP 伺服器
SMTP 連接埠
- 寄測試信,看看設定正不正確
在執行 smtp 的終端機下 會看見
Receiving message from: ('192.168.0.104', 37906)
Message addressed from: nobody@nowhere
Message addressed to : ['ss']
Message length : 355