Skip to main content

Transfers emails to Plone news items

Project description

Build Status


slc.mail2news is a simple way to convert emails to Plone News Items. The MailHandler browser view receives mails as formatted by and creates the item.

Plone 4 is recommended for using this packages. For Plone 3, additional packages like collective.contentrules.mail might be required to use the full functionality.


There are two ways to invoke the mail handler, as a browser view or as a console script:

As a browser view

cat testmail.txt | python "http://user:pass@localhost:8010/Plone/news/@@mail_handler"

To forward all emails sent to a certain address, create an alias for your mail program similar to this:

foo: "| python http://user:pass@localhost:8010/Plone/news/@@mail_handler"

where foo@domain is the address the emails will be sent to.

Replace localhost:8010 with your server name and port and user:pass with the credentials of a Plone user with the permission to add portal content in the folder where mail_handler is called (here /Plone/news, but can be any folder in principle). Use http://localhost:8010/Plone/@@usergroup-userprefs to create a user and http://localhost:8010/Plone/news/@@sharing to set permissions.

As a console script

In your buildout.cfg:

parts +=

recipe = zc.recipe.egg
eggs =
scripts = mail_handler
arguments = '${instance:location}/etc/zope.conf','admin',context_path=context_path
initialization =
    import sys
    context_path = sys.argv[1]
    sys.argv = sys.argv[:1]

Replace 'admin' with a user that has permission to add portal content in the folder where mail_handler is going to be called.

Then call the script like this:

cat testmail.txt | bin/mail_handler /Plone/news

The alias for your mail program then looks something like this:

foo: "| bin/mail_handler /Plone/news

You may have to specify the full path to the script.


To receive a notification whenever a mail is received and converted, first create a content rule (http://localhost:8010/Plone/@@rules-controlpanel) and choose "Object added to container" as the trigger event. After the rule has been created, edit it and add the action "Send email". Fill in subject, address and body. Add a condition and restrict content type to News Item, otherwise the notification will be active for everything you add to the site. Then you can add the rule to the folder where your News Items will reside (http://localhost:8010/Plone/news/@@manage-content-rules). Remember to configure email in the portal setup if you haven't done so yet (http://localhost:8010/Plone/@@mail-controlpanel).

References and Acknowledgements

slc.mail2news is based on MailBoxer can be found at



  • Tweak the title and description #SCR-72 [cillianderoiste]
  • Set expiration and effective dates. #FLOW-966 [reinhardt]

2.0.0 (2019-12-03)

  • Python 3 support [reinhardt]
  • Fix text cropping (Refs. #UNIBW-907) [ale-rt]
  • Add first attached image as lead image [reinhardt]
  • Wrap mail body lines after 50 characters [reinhardt]

1.0.4 (2016-03-18)

  • added docs to manifest [reinhardt]

1.0.3 (2016-03-18)

  • added mail_handler console script [reinhardt]

1.0.2 (2011-06-23)

  • changed format of created news item [blachnik, reinhardt]

1.0.1 (2011-06-15)

  • removed sender from title of news item [blachnik, reinhardt]

1.0 (2011-03-28)

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slc.mail2news-2.0.1.tar.gz (21.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page