1 ## Script (Python) "sendNotificationEmail"
2 ##bind container=container
6 ##bind subpath=traverse_subpath
10 #TODO : translate messages
11 #from Products.PlacelessTranslationService.MessageID import MessageIDFactory
12 #_ = MessageIDFactory('plinn')
13 _
= lambda x
: lambda : x
15 portal
= context
.portal_url
.getPortalObject()
17 mtool
= portal
.portal_membership
19 recipients
= sci
.kwargs
.get('recipients', [])
24 MailHost
= portal
.MailHost
25 from quopri
import encodestring
27 def encodeAdr(member
) :
28 name
= member
.getMemberFullName(nameBefore
=0)
29 email
= member
.getProperty('email')
30 qpName
= encodestring(name
).replace('=\n', '')
31 return '''"=?utf-8?q?%s?=" <%s>''' % (qpName
, email
)
36 sender
= mtool
.getAuthenticatedMember()
37 sender
= encodeAdr(sender
)
39 recipientsFormated
= map(encodeAdr
, mtool
.getMembers( recipients
))
40 mto
= ', '.join(recipientsFormated
)
47 """ % object.absolute_url()
50 message
= context
.echange_mail_template( From
= sender
52 , Subject
= "=?utf-8?q?%s?=" % encodestring(portal
.Title() + " : " + _("Document state change notificaction")()).replace('=\n', '')
53 , ContentType
= 'text/plain'
55 , body
=sci
.kwargs
.get('comment', '')
59 MailHost
.send( message
.encode('utf-8') )