mail_received.py 779 Bytes
Newer Older
Sebastien Robin's avatar
Sebastien Robin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
## Script (Python) "mail_received"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=theMail
##title=
##
import string

mail_message = None


if theMail['headers'].get('to').find('server') >= 0:
  id = theMail['headers'].get('subject')
  msg = theMail['body']
  context.portal_synchronizations.PubSync(id,msg=msg)

elif theMail['headers'].get('to').find('client') >= 0:
  id = theMail['headers'].get('subject')
  msg = theMail['body']
  context.portal_synchronizations.SubSync(id,msg=msg)



# the return of None indicates a success
# The return of anything else assumes that you are returning an error message
# and most MTA's will bounce that error message back to the mail sender
return None