[Zope] Mail Host problem

complaw@hal-pc.org complaw@hal-pc.org
Wed, 1 Aug 2001 22:50:28 GMT


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