1 ##parameters= rtool, request, member=None, password='', email=''
3 #TODO : translate messages
4 #from Products.PlacelessTranslationService.MessageID import MessageIDFactory
5 #_ = MessageIDFactory('cmf_default')
6 _
= lambda x
: lambda : x
7 from quopri
import encodestring
9 portal
= context
.portal_url
.getPortalObject()
10 mtool
= portal
.portal_membership
13 def convertMessage(msg
) :
14 return msg
.replace('${', '%(').replace('}', ')s')
16 def encodeAdr(member
) :
17 name
= member
.getMemberFullName(nameBefore
=0)
18 email
= member
.getProperty('email')
19 qpName
= encodestring(name
).replace('=\n', '')
20 return '''"=?utf-8?q?%s?=" <%s>''' % (qpName
, email
)
22 mfromName
= portal
.email_from_name
23 mfromEmail
= portal
.email_from_address
24 mfromQpName
= encodestring(mfromName
).replace('=\n', '')
25 mfrom
= '''"=?utf-8?q?%s?=" <%s>''' % (mfromQpName
, mfromEmail
)
28 mto
= encodeAdr(member
)
30 subject
= convertMessage(_("${portal_title}: Your Membership Information")()) % {'portal_title': portal
.title
}
35 pr(convertMessage(_("You have been registered as a member of \"${portal_title}\", which allows you to personalize your view of the website and participate in the community.")()) % {'portal_title': portal
.title
})
37 if portal
.description
:
39 pr(_("This describes the purpose of the website:")())
41 pr(portal
.description
)
44 pr(convertMessage(_("Visit us at ${portal_url}")()) % {'portal_url' : portal
.absolute_url()})
46 pr(convertMessage(_("Your member id and password are: Member ID: ${member_id} Password: ${password}")()) % {'member_id':member
.getId(), 'password':password
})
48 pr(_("You can use this URL to log in:")())
51 login_url
= mtool
.getActionInfo('user/login')['url']
55 if len(login_url
) > 70 :
56 pr(_("Be aware that this URL might wrap over two lines. If your browser shows an error message when you try to access the URL please make sure that you put in the complete string.")())
60 text
= '\n'.join(text
)
62 message
= context
.echange_mail_template( From
= sender
64 , Subject
= "=?utf-8?q?%s?=" % encodestring(subject
).replace('=\n', '')
65 , ContentType
= 'text/plain'
69 return message
.encode('utf-8')