Skip to main content

Build Status

Introduction

slc.mail2news is a simple way to convert emails to Plone News Items. The MailHandler browser view receives mails as formatted by smtp2zope.py 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.

Setup

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 smtp2zope.py "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 smtp2zope.py 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:

[buildout]
parts +=
    mail_handler

[mail_handler]
recipe = zc.recipe.egg
eggs =
    ${instance:eggs}
    slc.mail2news
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.

Notification

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 http://iungo.org/products/MailBoxer

smtp2zope.py can be found at http://svn.plone.org/svn/collective/MailBoxerTempDev/trunk/smtp2zope.py

Changelog

2.0.2 (2024-07-17)

  • Add HtmlToText method #2428 [reinhardt]

2.0.1 (2020-11-09)

  • 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

Metadata

Release files for slc.mail2news 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slc.mail2news 2.0.2
File Size Uploaded
slc.mail2news-2.0.2.tar.gz 22.0 kB Details

Release files / slc.mail2news-2.0.2.tar.gz

Download URL slc.mail2news-2.0.2.tar.gz
Size 22.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3f080ff44dd1c93f85335828d2379b7e03bd58b25b16df1ac0afeb4bf5bc2b66
BLAKE2b-256 checksum
How to use checksums
9bca1430c9d2e189c153f9cd0076906a47d704f0753fbd9f4f15a19c160e123a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

2.0.2 This release

1 release file

2.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page