Hi, I'm using a mailhost on my site in order to be able to send out emails. When a user registers into the site I want to validate the email address given to confirm, as much as is possible with a not too detailed function, that the address given is valid. Reading through forums I've concluded that all I need to do is to attempt to send a confirmation or test mail to the given address, if an SMTPSenderRefused error is received then I can assumed that there is something wrong with the mail addrees... the python script I'm using is simply: import smtplib try: Anvil_Page.MailHost.send("This is a test", 'ruth@ffff.com') except smtplib.SMTPSenderRefused: get_transaction().abort() return "Invalid email address: please press your browser's='back' key and correct it" else: return 0 The only problem is that when I try to test this script the zope login screen comes up and regardless what passwords and logins I try to enter, including the admin one, I end up with the error: "You are not allowed to access SMTPSenderRefused in this context" Any idea what I've got wrong?
--On Freitag, 17. Oktober 2003 16:19 Uhr +0200 Ruth Mizzi <ruth@anvil.com> wrote:
import smtplib try: Anvil_Page.MailHost.send("This is a test", 'ruth@ffff.com') except smtplib.SMTPSenderRefused: get_transaction().abort() return "Invalid email address: please press your browser's='back' key and correct it" else: return 0
The only problem is that when I try to test this script the zope login screen comes up and regardless what passwords and logins I try to enter, including the admin one, I end up with the error:
"You are not allowed to access SMTPSenderRefused in this context"
You're not allowed to use the smptlib in a PythonScript. This is an FAQ so check the mailinglist archives how to allow access to Python modules that are not allowed to be imported by default. -aj
participants (2)
-
Andreas Jung -
Ruth Mizzi