I picked up the following code from runyaga via the ZopeLabs site: try: mailhost=getattr(context, context.SuperValues('Mail Host')[0].id) except: raise AttributeError, "Cannot find a Mail Host object." mMsg = 'A test e-mail message \n that contains a few line breaks. \n ~rlc' mTo = 'docket.clerk@bakerbotts.com' mFrom = 'docket.clerk@bakerbotts.com' mSubj = 'Mail Host Test' mailhost.send(mMsg, mTo, mFrom, mSubj) -------------- I put a Mail Host object in the same folder as the above python script. Tried it and got the exception. runyaga said to have the Mail Host object below the script, so I put it in a folder object lower in the hierarchy. Still got the exception. Then I put the Mail Host object in the root folder. Still got the exception. Clearly I am not the Hostess with the mostest. Does anyone know where I should place my Mail Host so that I don't throw the exception? Incidentally, I have the option to hardwire the mail host directly into the code (its not going anywhere). the id for the Mail Host in question is mailhost. TIA, Ron
try checking the security settings of mailhost, I had this problem and I unchecked aquire permissions and set them manually (for 'use mailhost services'). dj On Wed, 1 Aug 2001 complaw@hal-pc.org wrote:
I picked up the following code from runyaga via the ZopeLabs site:
try: mailhost=getattr(context, context.SuperValues('Mail Host')[0].id) except: raise AttributeError, "Cannot find a Mail Host object."
mMsg = 'A test e-mail message \n that contains a few line breaks. \n ~rlc' mTo = 'docket.clerk@bakerbotts.com' mFrom = 'docket.clerk@bakerbotts.com' mSubj = 'Mail Host Test'
mailhost.send(mMsg, mTo, mFrom, mSubj)
--------------
I put a Mail Host object in the same folder as the above python script. Tried it and got the exception. runyaga said to have the Mail Host object below the script, so I put it in a folder object lower in the hierarchy. Still got the exception. Then I put the Mail Host object in the root folder. Still got the exception.
Clearly I am not the Hostess with the mostest. Does anyone know where I should place my Mail Host so that I don't throw the exception?
Incidentally, I have the option to hardwire the mail host directly into the code (its not going anywhere). the id for the Mail Host in question is mailhost.
TIA,
Ron
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
O
Incidentally, I have the option to hardwire the mail host directly into the code (its not going anywhere). the id for the Mail Host in question is mailhost.
not sure whether this matters or not, but try renaming the Mail Host object to MailHost.
TIA,
Ron
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
try: mailhost=getattr(context, context.SuperValues('Mail Host')[0].id) except: raise AttributeError, "Cannot find a Mail Host object." Perhaps you get an AttributeError on SuperValues()
Isn't it: superValues() ?? ...if it makes a difference at all. Besides, superValues() returns a sequence of objects ordered in how close they are to 'context', so you can: mailhost = context.superValues('Mail Host')[0] rm the try: for a moment and paste the error and traceback next time. Peter
participants (4)
-
bak -
complaw@hal-pc.org -
Dan Jacobs -
Peter Bengtsson