A monkey patch to send MailHost messages to standard out
This is a hack. :)
This product, when installed, will check if Zope is running in debug mode, and if so, monkey patch (that is, grab the internals of, squeeze tight, then rip hard, just like monkeys do) Zope’s MailHost class, meaning that any and all uses of a MailHost will be “fixed” so that instead of sending mail, it prints messages to the zope event log.
This is useful if you don’t have a local mailhost for testing, or if you prefer not to spam the crap out of yourself whilst finding out if your bulk mail script is working.
If Zope is not running in debug mode, it will not install itself. However, I wouldn’t recommend putting it on a production site. You never know what those monkeys may get up to…
You can optionally enable the PrintingMailHost with an environment variable as of version 0.3. See the installation instructions for more information about how to use it.
Works on Plone 3.3, Plone 4, Plone 5.0, 5.1 and 5.2 (in Python 2.7, 3.6 and 3.7).
- Dorneles Tremea <deo (AT) plonesolutions (DOT) com>
- Fixed to work both with old-style and new-style classes. Extended to also patch SecureMailBase from SecureMailHost, if available.
Clayton Parker <clayton (AT) sixfeetup (DOT) com>
Maurits van Rees <maurits (AT) vanrees (DOT) org>
Harald Friessnegger <harald (AT) webmeisterei (DOT) com>
To install Products.PrintingMailHost into your Plone instance in buildout, you can do this:
Add Products.PrintingMailHost to the list of eggs to install, e.g.:
[instance] ... eggs = ... Products.PrintingMailHost
If you want to enable PrintingMailHost when debug-mode is off:
[instance] ... environment-vars = ... ENABLE_PRINTING_MAILHOST True
If you want to disable PrintingMailHost when debug-mode is on:
[instance] ... environment-vars = ... ENABLE_PRINTING_MAILHOST False
If PrintingMailHost is enabled, and you additionally want to send each email to a fixed address, you can add another environment variable:
[instance] ... environment-vars = ... PRINTING_MAILHOST_FIXED_ADDRESS email@example.com
Or multiple addresses separated by spaces:
PRINTING_MAILHOST_FIXED_ADDRESS firstname.lastname@example.org email@example.com
For clarity: this first prints the email, with the original recipient address, and then sends an actual email with the same contents to the fixed address you have specified. The original recipient is visible in the To: field. It is similar to receiving a blind carbon copy (bcc) of an email, except that the original recipient never gets the email.
Re-run buildout in order to make any of the above changes active:
- Fix Python 3.9 compatibility. [thet]
- Fix support for MailHost 4.10 (see issue 33). [pbauer]
- Fixed SyntaxError in previous release. [tareqalam]
- Encoding fix for Python 3 [ajung]
- Restore compatability with plone.api. [pbauer]
- Add support Python 3 [pbauer]
- Check environment variables in Zope2 initialize instead of import time. This allows to configure environment-vars in zope.conf and use them when starting the instance with slc.zopescript [fRiSi]
- Treat FIXED_ADDRESS as a list. Previously, depending on your Plone version. a fixed address could get interpreted as a list of single-character email addresses, which of course does not work. Now it works properly. You can also give a list of addresses by separating them using spaces: firstname.lastname@example.org email@example.com. Fixes https://github.com/collective/Products.PrintingMailHost/issues/4 [maurits]
- Add environment variable PRINTING_MAILHOST_FIXED_ADDRESS to send all emails to a single, fixed address. PrintingMailHost still needs to be enabled, so this is in addition to printing. https://github.com/collective/Products.PrintingMailHost/issues/2 [maurits]
- Since we can enable PMH via an environment variable and thus when not running in debug mode / foreground, emails are no longer printed, but written to the zope event log. [pysailor]
- Also patch (Secure)MaildropHost when available. [maurits]
- Allow passing keyword ‘immediate’. Needed for Plone 4 compatibility. [maurits]
- Fix email Message import [claytron]
- Rough support for multipart email messages [iElectric]
- Decode base64 encoded email messages [claytron]
- Added environment variable (ENABLE_PRINTING_MAILHOST) to enable or disable PrintingMailHost [claytron]
- Update README and HISTORY.txt [claytron]
- Release as an egg to PyPi [claytron]
- Updated to use the new standard log mechanism: logging.getLogger. Reformated messages/docstrings. [dtremea] (2006-03-17)
- Extended to also patch SecureMailBase from SecureMailHost, if available. [dtremea] (2005-10-23)
- Fixed to work both with old-style and new-style classes, as in the later, dict is a ‘dictproxy’ instance, which doesn’t have the setitem method. Bumpped version. Noted changes. And clean up whitespaces, of course… ;-) [dtremea] (2005-10-23)
- Initial creation/release [optilude] (2005-04-05)
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size Products.PrintingMailHost-1.1.6.tar.gz (12.2 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for Products.PrintingMailHost-1.1.6.tar.gz