Supprimer un message
philfr
Le serveur:
import smtpd, email
class mysmtpd(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpts, data):
msg=email.message_from_string(data)
print "Tel: ", msg["Subject"]
print "Message: ", msg.get_payload()
# ici appeler le script avec les arguments
mys=mysmtpd(("127.0.0.1",2525),None)
smtpd.asyncore.loop()
L'échange SMTP:
philfr@punch:~$ telnet localhost 2525
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 server1.here.be Python SMTP proxy version 0.2
HELO phil
250 server1.here.be
MAIL FROM: phil@here.be
250 Ok
RCPT TO: phil@there.be
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: <phil@here.be>
To: <phil@there.be>
Subject: +324759874556
Coucou message
.
250 Ok
Le résultat côté serveur:
philfr@punch:~/tmp/pysmtp$ python mysmtpd.py
Tel: +324759874556
Message: Coucou message
Qui dit mieux ?
import smtpd, email
class mysmtpd(smtpd.SMTPServer):
def process_message(self, peer, mailfrom, rcpts, data):
msg=email.message_from_string(data)
print "Tel: ", msg["Subject"]
print "Message: ", msg.get_payload()
# ici appeler le script avec les arguments
mys=mysmtpd(("127.0.0.1",2525),None)
smtpd.asyncore.loop()
L'échange SMTP:
philfr@punch:~$ telnet localhost 2525
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 server1.here.be Python SMTP proxy version 0.2
HELO phil
250 server1.here.be
MAIL FROM: phil@here.be
250 Ok
RCPT TO: phil@there.be
250 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
From: <phil@here.be>
To: <phil@there.be>
Subject: +324759874556
Coucou message
.
250 Ok
Le résultat côté serveur:
philfr@punch:~/tmp/pysmtp$ python mysmtpd.py
Tel: +324759874556
Message: Coucou message
Qui dit mieux ?