Description
PloneFormGen is a contentish editor for creating Plone forms through Plone edit interface.
By default if SMTP server rejects the message send by PloneFormGen the page will crash with an exception. Possible reasons for SMTP failure are
If you have a situation where gathering the data is critical the following process is appropriate
Example PloneFormGen script adapter (using proxy role Manager):
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
# This script will send email to several recipients
# each written down to its own email field
# whose id starts with "email-"
emails = []
for key in fields:
if key.startswith('email-'):
if fields[key] != '':
emails.append(fields[key])
mailhost = getToolByName(ploneformgen, 'MailHost')
subject = "Huuhaa"
# Custom message with a name filled in
message = u"""Hello,
Thanks for participating %s !
Cheers,
http://www.opensourcehacker.com
""" % (fields['etunimi'])
source = "info@opensourcehacker.com"
for email in emails:
try:
mailhost.secureSend(message, email, source, subject=subject, subtype='plain', charset="utf-8", debug=False, From=source)
except Exception:
pass
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.
For basic information about updating this manual and Sphinx format please see Writing and updating the manual guide.