Files @ 9376ca7157f3
Branch filter:

Location: kallithea/docs/usage/email.rst

9376ca7157f3 3.9 KiB text/prs.fallenstein.rst Show Annotation Show as Raw Download as Raw
Mads Kiilerich
compare: correct display of special branch names in initial placeholder

When a branch name contains special characters like '<' or '>', and a
'compare' operation is performed with such branch as one of the two compare
sides, then the special branch name will be part of the URL, e.g.

http://localhost:5000/myrepo/compare/branch@master...branch@%3Cscript%3Eblabla%3C/script%3E?other_repo=myrepo

The encoded branch name is then used at page load as placeholders for the
branch selection dropdowns. But, the special characters, were escaped too
much, causing '<' to become &lt; in the display of the dropdown.

The placeholder was escaped via the default mako escape filter, before being
passed to make_revision_dropdown, thus too early. We want the raw value.
h.js() (copied from the default branch) gives us that, while still
formatting and escaping the string so it is safe inside the script tag.
.. _email:

==============
Email settings
==============

The Kallithea configuration file has several email related settings. When
these contain correct values, Kallithea will send email in the situations
described below. If the email configuration is not correct so that emails
cannot be sent, all mails will show up in the log output.

Before any email can be sent, an SMTP server has to be configured using the
configuration file setting ``smtp_server``. If required for that server, specify
a username (``smtp_username``) and password (``smtp_password``), a non-standard
port (``smtp_port``), encryption settings (``smtp_use_tls`` or ``smtp_use_ssl``)
and/or specific authentication parameters (``smtp_auth``).


Application emails
------------------

Kallithea sends an email to `users` on several occasions:

- when comments are given on one of their changesets
- when comments are given on changesets they are reviewer on or on which they
  commented regardless
- when they are invited as reviewer in pull requests
- when they request a password reset

Kallithea sends an email to all `administrators` upon new account registration.
Administrators are users with the ``Admin`` flag set on the *Admin > Users*
page.

When Kallithea wants to send an email but due to an error cannot correctly
determine the intended recipients, the administrators and the addresses
specified in ``email_to`` in the configuration file are used as fallback.

Recipients will see these emails originating from the sender specified in the
``app_email_from`` setting in the configuration file. This setting can either
contain only an email address, like `kallithea-noreply@example.com`, or both
a name and an address in the following format: `Kallithea
<kallithea-noreply@example.com>`. However, if the email is sent due to an
action of a particular user, for example when a comment is given or a pull
request created, the name of that user will be combined with the email address
specified in ``app_email_from`` to form the sender (and any name part in that
configuration setting disregarded).

The subject of these emails can optionally be prefixed with the value of
``email_prefix`` in the configuration file.

A Kallithea-specific header indicating the email type will be added to each
email. This header can be used for email filtering. The header is of the form:

    X-Kallithea-Notification-Type: <type>

where ``<type>`` is one of:

- ``pull_request``: you are invited as reviewer in a pull request
- ``pull_request_comment``: a comment was given on a pull request
- ``cs_comment``: a comment was given on a changeset
- ``registration``: a new user was registered
- ``message``: another type of email


Error emails
------------

When an exception occurs in Kallithea -- and unless interactive debugging is
enabled using ``set debug = true`` in the ``[app:main]`` section of the
configuration file -- an email with exception details is sent by WebError_'s
``ErrorMiddleware`` to the addresses specified in ``email_to`` in the
configuration file.

Recipients will see these emails originating from the sender specified in the
``error_email_from`` setting in the configuration file. This setting can either
contain only an email address, like `kallithea-noreply@example.com`, or both
a name and an address in the following format: `Kallithea Errors
<kallithea-noreply@example.com>`.

*Note:* The WebError_ package does not respect ``smtp_port`` and assumes the
standard SMTP port (25). If you have a remote SMTP server with a different port,
you could set up a local forwarding SMTP server on port 25.


References
----------

- `Error Middleware (Pylons documentation) <http://pylons-webframework.readthedocs.org/en/latest/debugging.html#error-middleware>`_
- `ErrorHandler (Pylons modules documentation) <http://pylons-webframework.readthedocs.org/en/latest/modules/middleware.html#pylons.middleware.ErrorHandler>`_


.. _WebError: https://pypi.python.org/pypi/WebError