[Zope] looking for mailhost doc

Stephen Pitts smpitts@midsouth.rr.com
Fri, 4 Feb 2000 22:27:37 -0600


--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii

On Sat, Feb 05, 2000 at 02:09:09AM +0100, Gijs Reulen wrote:
> Hello
> 
> I would like to use the Zope MailHost for receiving, processing and 
> storing preformatted (maybe XML) email. Is that possible ? I cannot 
> find any docs on the mailhost; where should I look ?
> 

MailHost is only used to send mail, primarily with the <dtml-sendmail
tag>. My suggestion to you would be to create a ZClass called
MailMessage or something similar (you could inherit from XMLDocument or
DTMLDocument) to store the mail messages in ZODB and then use a python script
invoked via .procmailrc to actually upload the messages to Zope. I've
attached a python script I've got that uploads a directory of JPEGs as
Photo objects. You might find it useful as an example.

If you are still interested in using <dtml-sendmail>, I've submitted a patch
to Digital Creations that cleans up the MailHost code considerably. It should 
be in the next release of Zope, but if you are having trouble with the
tag, I'd be glad to send you a copy of the patch.
-- 
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="uploadphotos.py"

from urllib import urlopen, urlencode
from sys import argv

basepath="http://localhost:8080/centralchurch/Photos/"
foldername = argv[1]
files = argv[2:]

url = basepath + foldername + "/manage_addProduct/Photo/manage_addPhoto"
print "Uploading files to " + url
args = {}

for filename in files:
	print "Uploading " + filename
	args['id'] = filename
	args['title'] = filename
	args['file'] = open(filename).read()
	urlopen(url,urlencode(args))


--tKW2IUtsqtDRztdT--