Process documents via e-mail with mailfrom hooks: unique token address, transformation and custom domain.
Not every system can deliver documents through an API connection. With a mailfrom hook you make it possible to submit documents as e-mail attachments to the PSB. The PSB generates a unique e-mail address with a token (for example [email protected]). Any document sent as an attachment to this address is automatically processed as an invoice, order or other document type.
When you create a mailfrom hook the PSB generates a unique token address. You configure via a publishTopic what should happen with the incoming documents, for example sending via Peppol (SendInvoice) or processing as a received document (ReceiveInvoice).
The flow is as follows:
publishTopicRegister a hook via the API with a mailfrom:// action. Use $token$ as a placeholder; the PSB replaces this with the generated token in the response.
{
"id": "1",
"name": "mail from trigger",
"action": "mailfrom://*&[email protected]",
"publishTopics": [
"SendInvoice"
],
"isActive": true
}
After registration the response contains the actual token address:
mailfrom://*&[email protected]
From that moment on, all attachments sent to [email protected] are processed as invoices and published on the SendInvoice topic.
The action is composed of a from and to part:
mailfrom://{from}&to={to}
The token address can be placed in either the from or the to part. At least one of the two must contain the token, so the PSB can link the e-mail to the correct hook.
mailfrom://*&[email protected]mailfrom://[email protected]&[email protected]The wildcard * in the from part means that e-mails from any sender address are accepted. If you want to restrict which senders may submit documents, enter a specific e-mail address.
@accp.econnect.email@econnect.emailNote: always use the correct domain per environment. E-mails sent to the production domain are processed as real documents and cannot be undone.
Optionally you can specify a sourceDocumentTypeId and targetDocumentTypeId as query parameters. The PSB then automatically transforms the attachment to the specified target format, provided a suitable transformation is available. Special characters in the documentTypeId must be URL-encoded.
{
"id": "1",
"name": "mail from met transformatie",
"action": "mailfrom://*&[email protected]?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": [
"SendInvoice"
],
"isActive": true
}
A mailfrom hook supports exactly one publishTopic. This topic determines how the PSB processes the incoming documents.
SendInvoiceReceiveInvoiceRecognizeSalesInvoiceTip: by using
RecognizeSalesInvoiceas the publish topic, you can submit PDF invoices by e-mail and have them automatically recognised by the IDR. This combines mailfrom with intelligent document recognition.
By default the PSB uses the domain econnect.email (or accp.econnect.email for acceptance). It is also possible to use a custom domain, so the e-mail address matches your own organisation. Contact eConnect to set this up.
publishTopic. For different processing types (sending, receiving, recognition) you create separate hooks.During registration the PSB replaces $token$ with the generated unique token in the e-mail address; the response contains the definitive mailfrom:// path. Only addresses with that token are linked to your hook, so incoming mail is processed specifically.
For acceptance you use addresses on @accp.econnect.email, for production on @econnect.email. E-mails to the production domain are processed as real document flows and cannot easily be reversed; choose the environment deliberately.
No: a mailfrom hook supports exactly one publishTopic. For different processing types, such as SendInvoice, ReceiveInvoice or RecognizeSalesInvoice, you create separate hooks, each with its own token address and publish topic.
See the full API specification at psb.econnect.eu for all configuration options and examples.
View the API documentation