Thanks David for the code I really appreciate it, but I really wanted
to use the Web2py Mail() API to get the STMP work in my application...
Did anyone already made it work using Web2py Mail() component ? If Yes
what was your setting ?

Thanks for your help here,
Yannick P.

On Feb 28, 2:09 pm, David Marko <dma...@tiscali.cz> wrote:
> Hello,
> here is a very short code snippet that works as a simple smtp server .
> It waits on localhost:25 and each message is saved as a file. I think
> the code is very self-describing ...
> (not sure how code indentation will look like, but I havent found the
> way how to upload the file here)
>
> David
>
> <code>
> from datetime import datetime
> import asyncore
> from smtpd import SMTPServer
>
> class EmlServer(SMTPServer):
>     no = 0
>     def process_message(self, peer, mailfrom, rcpttos, data):
>         filename = '%s-%d.eml' % (datetime.now().strftime('%Y%m%d%H%M
> %S'),
>                 self.no)
>         f = open(filename, 'w')
>         f.write(data)
>         f.close
>         print '%s saved.' % filename
>         self.no += 1
>
> def run():
>     foo = EmlServer(('localhost', 25), None)
>     print "Local SMTP server running on port 25"
>     try:
>         asyncore.loop()
>     except KeyboardInterrupt:
>         pass
>
> if __name__ == '__main__':
>         run()
>
> </code>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to