How about setting the proxy role of your Register script to 'Manager'? (to allow Register to invoke your external method)


----- Original Message ----- From: "Susana Beatson" <[EMAIL PROTECTED]>
To: <>
Sent: Friday, July 08, 2005 9:59 AM
Subject: [Zope] sending e-mail in external methods

Hello everybody,
I am a new zope user that has received an application to maintain and
I'm learning about zope at the same time.
One of the features of the app requires users to subscribe to receive
a newsletter.
A user is presented with a very simple form
<form method="post" tal:attributes="action
string:${here/absolute_url}/Register" metal:fill-slot="content">
Name: <input name="name" type="text" tal:attributes="value
<br />
<br />
Email address: <input name="email" type="text" tal:attributes="value
<br />
<br />
<input type="submit" name="add" value="Submit">

The code for Register simply validates the input and calls a function
defined in an external module to send an e-mail to the person sending
the request, to verify ownership of the e-mail address.
This code is something like:

errors = []
name = form.get('name','').strip()
email = form.get('email','').strip()
if not context.validateForm(email, name):
   errors.append('- Problems occurred with input data')
if errors:
   errors.insert(0,'The following problems require correcting:')
   return context.register_index(messages=errors)

import md5
from Products.PythonScripts.standard import url_quote

sendEmail(['%s <%s>' % (name,email)],
   'Newsletter Registration Request',
Thank you for requesting more information about our Newsletter.
Blah, blah, blah. To complete your registration please click on the link below


Once you have done so, you will receive an e-mail confirming your registration.

If you have any problems please email %s
""" % (
       url_quote(name),'%s%s%sSomeHashHiddenPassword' %

return context.register_index(name=name, email=email, message="A
confirmation email has been sent to the address you provided.")

The problem I have is that the sendEmail() function always requires
the user to be logged in as manager of the portal to work. Whenever I
click on the "Submit" button, I am asked to log in and the code will
only proceed after successful log in. The same happens with Register2
that also sends an e-mail to confirm successful registration. When the
user receives the e-mail to confirm his data and clicks on the link,
he gets added to the database successfully and he should be sent an
e-mail. But again, that only happens if the user is logged in as
As I am new to zope I'm sure I'm missing on something important about
external methods, can anyone help?
Thanks in advance,
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to