Metadata-Version: 2.0
Name: pserver.mailer
Version: 1.0.1.dev0
Summary: UNKNOWN
Home-page: https://github.com/pyrenees/pserver.mailer
Author: Nathan Van Gheem
Author-email: nathan.vangheem@wildcardcorp.com
License: BSD
Keywords: async mail plone
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: setuptools
Requires-Dist: plone.server
Requires-Dist: repoze.sendmail (>=4.1)
Requires-Dist: transaction
Requires-Dist: html2text
Requires-Dist: aiosmtplib

.. contents::

PSERVER.MAILER
==============


Configuration
-------------

config.json can include mailer section::

    "applications": ["pserver.mailer"],
    "mailer": {
      "default_sender": "foo@bar.com",
      "endpoints": {
        "default": {
          "type": "smtp",
          "host": "localhost",
          "port": 25
        }
      }
    }


Printing mailer
---------------

For development/debugging, you can use a console print mailer::

    "applications": ["pserver.mailer"],
    "mailer": {
      "default_sender": "foo@bar.com",
      "endpoints": {
        "default": {
          "type": "smtp",
          "host": "localhost",
          "port": 25
        }
      },
      "utility": "pserver.mailer.utility.PrintingMailerUtility"
    }


Sending mail
------------

POST http://localhost:8080/zodb/plone/@mailer

    {
      "sender": "foo@bar.com",
      "recipient": "john@doe.com",
      "subject": "Some subject",
      "text": "Hello"
    }


Permissions
-----------

`pserver.mailer` defines a permission `mailer.SendMail` which, by default,
only the `plone.SiteAdmin` role is assigned.


Using the mailer in code
------------------------

You can also directly use the mailer in your code::

    from zope.component import queryUtility
    from pserver.mailer.interfaces import IMailer
    mailer = queryUtility(IMailer)
    await mailer.send(recipient='john@doe.com', subject='This is my subject', text='Body of email')

1.0.1 (unreleased)
------------------

- nothing yet...

1.0.0 (2017-02-01)
------------------

- Initial release


