# Tutorial: Process email

Hooks with the mailfrom action are used to enable the possibility to process one or multiple documents as an attachment to a specific email address by using a unique token.

This flow requires a publish topic for example SendInvoice, ReceiveInvoice, RecognizeSalesInvoice etc. to determine what kind of document is used. mailfrom actions only support one publish topic per hook.

# Configuration

mailfrom hooks are registered via the subscribe endpoint on the Hook controller, using the mailfrom:// action.

While configuring the hook '$token$' is used as a placeholder for a token and will be replaced in the PUT response.

For example:


will result in:


The mailfrom hook consists of one mandatory part and two optional parameters. The first part is the connection info, containing the 'from' email address and the 'to' address as a query parameter.


To be able to process the invoices from the attachments either the 'from' email address or the 'to' email address needs to contain the token generated when subscribing the hook. The action can be configured to send an email from one specific address or using a wildcard (*) to allow sending from multiple adresses.

For example:




Optionally, query parameter sourceDocumentTypeId={source} and targetDocumentTypeId={target} can be used to specify a target documentTypeId. The attached document will be transformed to this document type, given a transformation from the original to the target documentTypeId is available. Special characters in the documentTypeId have to be url encoded.

mailfrom example:

	"id": "1",
	"name": "mail from trigger",
	"action": "mailfrom://*&to=$token$@econnect.email?sourceDocumentTypeId=urn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-2%3A%3AInvoice%23%23urn%3Acen.eu%3Aen16931%3A2017%23compliant%23urn%3Afdc%3Anen.nl%3Anlcius%3Av1.0%3A%3A2.1&targetDocumentTypeId=urn%3Aoasis%3Anames%3Aspecification%3Aubl%3Aschema%3Axsd%3AInvoice-2%3A%3AInvoice%23%23urn%3Acen.eu%3Aen16931%3A2017%23compliant%23urn%3Afdc%3Anen.nl%3Anlcius%3Av1.0%3A%3A2.1",
	"publishTopics": [
	"isActive": true

By default the 'to' address is an econnect.email address or accp.econnect.email for acceptance, but it is also possible to use your own domain. Please contact us for more information.

© 2024 eConnect International B.V.