Skip to main content

This package aims to provide language dependent character set for sending emails form Plone site.

Project description

Introduction

Character set of outgoing mail of Plone is defined in a portal property name “email_charset” and this charset set is globally used in the Plone site. This is fine with monolingual site, however in multilingual site, there are cases you want to send mails with differernt character sets for different languages.

This package aims to provide language dependent character set for sending emails form Plone site.

There are five main default cases for sending e-mails from Plone site:

  1. When new user registers to the site with password setting disabled.

  2. When a user forgets password and plone sends the user the guide to reset it.

  3. When user contacts administrator form contact form.

  4. When sending content to somebody from “Send this” link.

  5. When content rules trigers sending mail, ex) when adding content to a certain folder.

All these five cases are supported by this package, however tests are only done with character set of iso-2022-jp for Japanese language and utf-8 for other languages.

Setting language and character set

Once you installed this package from quickinstaller, go to ZMI of the plone site. Within portal_properties, there is mailhost_properties where you can set two propeties.

  • lang_charset

    ‘ja|iso-2022-jp’ is default value. This means for Japanese language (‘ja’), use character set ‘iso-2022-jp’. To add other language and character set pair, add it line by line. Remenber to follow this syntax: language|charset

  • is_member_lang_effective

    If this option is selected, logged in member receives e-mail with the character set of member’s choice of languages.

Script example for your own code

To use this feature in your own package, simply apply ILangCharset interface to portal object like:

>>> from collective.langMailHost.interfaces import ILangCharset
>>> email_charset = ILangCharset(portal).effective_charset() or portal.getProperty('email_charset', 'UTF-8')
>>> mailhost.secureSend(message, email_recipient, source,
                            subject=subject, subtype='plain',
                            charset=email_charset, debug=False,
                            From=source)

Changelog

0.1.0 - (2009-08-31)

  • Initial release

Installation

To install collective.langMailHost into the global Python environment (or a workingenv), using a traditional Zope 2 instance, you can do this:

  • When you’re reading this you have probably already run easy_install collective.langMailHost. Find out how to install setuptools (and EasyInstall) here: http://peak.telecommunity.com/DevCenter/EasyInstall

  • Create a file called collective.langMailHost-configure.zcml in the /path/to/instance/etc/package-includes directory. The file should only contain this:

    <include package="collective.langMailHost" />

Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance recipe to manage your project, you can do this:

  • Add collective.langMailHost to the list of eggs to install, e.g.:

    [buildout]
    eggs =
    collective.langMailHost
  • Tell the plone.recipe.zope2instance recipe to install a ZCML slug:

    [instance]
    recipe = plone.recipe.zope2instance
    zcml =
    collective.langMailHost # 1
    collective.langMailHost-overrides # 2
  • Re-run buildout, e.g. with:

    $ ./bin/buildout

You can skip the ZCML slug # 1 if you are going to explicitly include the package from another package’s configure.zcml file, but not # 2.

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

collective.langMailHost-0.1.0.tar.gz (19.9 kB view details)

Uploaded Source

File details

Details for the file collective.langMailHost-0.1.0.tar.gz.

File metadata

File hashes

Hashes for collective.langMailHost-0.1.0.tar.gz
Algorithm Hash digest
SHA256 236daca6966f0b79f7f950a3c125134c0fec3bb06b0c6fbfbd4e80b426572dd2
MD5 b9e1e8c1f930aa45b7b5bfe69f29e84a
BLAKE2b-256 0e75bd03a1ca004a0488a3e5428100a5117002f096ab3aff34e44363754ec47e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page