2012-01-13 2 views
1

누군가이 SMTP 서버에 연결할 때 내 자신의 메시지를 보내고 싶습니다.Python SMTPD 라이브러리가 버전을 대체합니다.

220 Win7-PC Python SMTP proxy version 0.2 

가 어떻게 "TEST 전자 메일 서버"를 볼 수 파이썬에서 환영 메시지를 무시 않습니다

import smtpd 
import asyncore 

class FakeSMTPServer(smtpd.SMTPServer): 
    __version__ = 'TEST EMAIL SERVER' 

    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 

if __name__ == "__main__": 
    smtp_server = FakeSMTPServer(('localhost', 25), None) 
    try: 
     asyncore.loop() 
    except KeyboardInterrupt: 
     smtp_server.close() 

그러나, 나는 여전히 응답는 무엇입니까?

답변

0

그냥

smtpd.__version__ = "TEST EMAIL SERVER" 

곳을 (import 문 후 수 있음) 할.