Print document, recognize email address from it and email it automatically as attachment

This article will guide you through the process of configuring a profile that searches for an email address in a document, places the email address in the To:-field (CC: and BCC: are also possible) and sends the document to the email address as attachment.

Prerequisites

  • Make sure email settings are configured so that you are able to email.
    Go to Manage > System Setup > System Settings > General email settings
  • Understand how document previews work and how to enable preview mode. This comes in handy when configuring recognitions.

Print&Share CQ configuration

  1. To make the configuration of the recognition easier, get the document that you want to print (and email) and print it with preview mode to Print&Share CQ.
  2. First log in to the admin panel using a web browser.
  3. Navigate to Manage > Workflow > Profiles
  4. Create a profile by clicking Create new and give the profile a name.
  5. Scroll down to the Channels-section, select the Email-option and click the Add Channel button. This will add a channel with email functionality to the profile.
  6. Click the pencil-icon to edit the newly added channel. This will allow you to configure the channel.
  7. We want to recognize an email from the document and put it in the To: field. To do this, scroll down to the Email message-section and click on the To: label.
  8. Enable email recognition, and click Add rule to add a new recognition rule.
  9. For the Email recognition click the ...-button to edit the recognition.
  10. Now select Recognition type: Value and for Regex type: Email.
    This will use a basic regular expression for extracting an email. If you printed a job using preview mode you should be able to see the preview and the email highlighted.
    Image
  11. Click OK to save and close the dialogs.
  12. In the Email message-section, fill in a corresponding email next to the From: label.
  13. At the channel configuration scroll to the top and click Save to save the configuration.

Now every job that you send will extract the email and send an email to that email address with the printed document as an attachment.

?

My email is not recognized. Why?

Currently the recognition relies on OCR. In some cases if for example the font is too small, a certain font family is used, the OCR might not return correct results. An option might be changing to another OCR reader. This can be done at:
Manage > System Setup > System settings > OCR Settings:.

Even better might be not be dependent on OCR and for example use a barcode like Data Matrix. This could only work if you are able to design or adjust your reports or documents so that it contains a barcode. When printing you can adjust the email recognition.
Instead of using Recognition type: Value and for Regex type: Email for the email recognition, you could use the option: Recognition type: Barcode and then select the specific barcode(s), e.g. Data Matrix.

In case your barcode contains multiple email addresses, you could modify the found result:

  1. in the recognition click the Extra Options tab.
  2. Select Regex and click Add result adjuster to add the adjuster.
  3. Specify a regular expression for emails containing a group. For example: \s*(([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+))\s*
  4. Change the option of Regex group: to Group 1 or the group that contains your regex.
  5. This will give back all email addresses from the line that you had.

For example:

Barcode data contains: info@winking.be support@winking.be +3251232480
Barcode recognition extracted the result: info@winking.be support@winking.be +3251232480
The result adjuster applies a regular expression to that result, you select the results of a specific regex group and finally this will result in two emails as a regular expression match.
These two emails will then be used for the To: field.