ONYX - 9.0
Envoi de fichiers PDF par e-mail/en
This documentation describes the function allowing PDF files to be sent by email (sending from an XPS file). This function is found in the workflow in the “Mail”, “Send PDF E-Mail” section.
Sommaire
- 1 Interface description
- 2 Examples
- 2.1 Variant 1: Sending email with attachment name and email body in plain text
- 2.2 Variant 2: Sending email with variable attachment name and email body in plain text
- 2.3 Variant 3: Sending email with attachment name coming from an index in the input XPS file
- 2.4 Variant 4: Sending email with a variable destination address
- 2.5 Variant 5: Sending an email with a Body and a Footer
- 2.6 Variant 6: Sending an email with an HTML body calling an external HTML file
- 2.7 Variant 7: Sending an email with an HTML body calling an external HTML file with variable data
- 2.8 Variant 8: Sending an email with an HTML body calling a dynamic external HTML file based on a company code
- 3 Notes
Interface description
To access the interface for sending PDFs by e-mail, double click on the command in question, choose Mail then click on "Send May PDF"
Standard tab
To: This parameter allows you to enter the destination addresses
Cc: This parameter allows you to enter the addresses in copy (OPTIONAL)
Email subject: This parameter allows you to enter the subject of the email (OPTIONAL)
Note: Multiple recipients or copies can be entered, each separated by a semicolon. “; »
HTML BODY tab
This tab allows you to enter the body of the email to send.
Note: You can either type HTML directly or call an HTML file by typing the following syntax: FILE: C:\MyHtmlFile.html
XPS settings tab
This tab allows you to enter the XPS file to be converted by PDF and sent by email Input file: This parameter allows you to specify the XPS file to convert to PDF and send by email Profile: This parameter allows you to specify an XPS to PDF conversion profile
Attachment tab
This tab allows you to enter the name of the attachment
Attachment filename: This parameter allows you to specify the name of the attachment
Server options tab
This tab allows you to enter the parameters of the SMTP server used for sending emails.
SMTP server: This parameter allows you to enter the IP address of the SMTP server or its DNS name SMTP domain: This parameter allows you to enter the domain name of the SMTP server SMTP port: This parameter allows you to enter the port number used for sending the email SMTP server login: This parameter allows you to enter the login used for connecting to the SMTP server SMTP server password: This parameter allows you to enter the password used for connecting to the SMTP server
Mail options tab
This tab allows you to enter the sender of the email, the hidden copy (OPTIONAL), as well as the sending options (acknowledgment of receipt or read receipt)
- From: This parameter allows you to enter the sender of the email
- Bcc: This parameter allows you to enter the hidden copy(ies) of the email
- Acknowledgment: This option allows you to request an acknowledgment of receipt (if checked)
- Read receipt: This option allows you to request a reading receipt (if checked)
Note: Multiple blind copy recipients can be entered, each separated by a semicolon “; »
Mail tab format
This tab allows you to enter the body of the email in Text mode (and not HTML), the footer of the email (in HTML mode or in Text mode)
- Body text: This parameter allows you to enter the body of the email in text mode (no formatting)
- HTML footer: This parameter allows you to enter the footer of the email in HTML mode (write directly from HTML)
- Text footer: This parameter allows you to enter the footer of the email in text mode (no formatting)
Note: You can either type HTML directly or call an HTML file by typing the following syntax: FILE: C:\MyHtmlFile.html
Examples
Variant 1: Sending email with attachment name and email body in plain text
Let's take the following workflow as an example:
The “Send PDF mail” box must absolutely receive an XPS file. Any other file will be refused and an error will appear in the logs.
The box parameters are:
The file sent is the file received by the “MAP_FILE_IN” environment parameter box, it is entirely possible to put a hard file (for example: C:\MyFichier.xps). In this example, the input file would then only serve as a trigger.
Since it is a PDF sending box by email, there is no need to specify the name of the extension, a PDF will automatically be included in the email.
- This action sends an email to “jdieu@mappingsuite.com” on behalf of “jdieu@mappingsuite.com” with an attachment MyAttachment.pdf and for body:
This is my first line of my email body
This is my second line of my email body
This is my third line of my email body
Variant 2: Sending email with variable attachment name and email body in plain text
In this example, we send an email with an attachment having a dynamic name equal to the name of the input file received by the rules engine, and a dynamic body having the name of the attachment on it.
In this example, the file sent to the workflow is called Attachment_jerome.xps
Let's take the following workflow as an example:
A) “Parameter” action: FILENAME_TEMP
This action allows you to initialize a variable with part of another variable.
Here we:
- Let's create a variable: FILENAME_TEMP
- Let's initialize this variable with the basename of the MAP_TITLE variable
(ex: MAP_TITLE: C:\Repertoire\attachment_Jerome.xps -> The basename is: attachment_Jerome.xps)
In our example, the value of FILENAME_TEMP is Attachment_Jerome.xps
B) “Parameter” action: FILENAME The goal of this 2nd box is to have a variable (here FILENAME) equal to “Attachment_Jerome” and not “Attachment_Jerome.xps” and then use it.
Here we:
- Let's create a variable: FILENAME
- Let's initialize this variable with the part of the FILENAME_TEMP up to the point
In our example, the FILENAME value is “Attachment_Jerome”. We will use this FILENAME variable to name the attached file and indicate it in the body of the Mail.
C) “Parameter” action: Send_PDF_mail
This action allows you to send the Email.
Here we name the attached file with the variable FILENAME (here in blue: Corresponds to a parameter and not to a hard value)
Note: It is possible to call a variable by indicating [%, and this time in VALUE mode (black text).
In our example, the parameter would be:
In this case, we are mixing hard text with a variable. Therefore the variable must absolutely be specified with [% because we cannot mix PARAM values (blue) with VALUE values (black)
Variant 3: Sending email with attachment name coming from an index in the input XPS file
In this example, we send an email with an attachment having a dynamic name equal to a value of an index present in the XPS file, and a dynamic body having the name of the attachment on it.
In this example, the sent file has an index called IDX_QNUFAC with the value 00057109
Let's take the following workflow as an example:
A) “Parameter” action: INDEX_VALUE
This action allows you to initialize a variable with the value of an index present in the XPS file received as input.
Here we:
- Let's create a variable: INDEX_VALUE
- Let's initialize this variable with the first value of the IDX_QNUFAC index found in the XPS file (here 00057109)
In this example, the value of IDX_QNUFAC is “00057109”
B) “Parameter” action: Send_PDF_mail
This action sends the email.
Here we name the attached file with the variable FILENAME (here in blue corresponding to a parameter and not to a hard value).
Note: It is possible to call a variable by indicating [%, and this time in VALUE mode (black text).
In our example, the parameter would be:
Variant 4: Sending email with a variable destination address
The method is the same as for the variable attachment name.
You must initialize a variable with the value of the email address and use it in the tab.
Here the variable “EMAIL_TO” is initialized with the value of the index of the input XPS file “IDX_EMAIL”
Then, its value is used in the “Send PDF mail” box.
In this case, we are mixing hard text with a variable. Therefore the variable must absolutely be specified with [% because we cannot mix PARAM values (blue) with VALUE values (black)
This variant allows you to send a PDF by email by specifying a BODY and a FOOTER. To do this, you must use the body from the 2nd tab “HTML Body”. The Html Body of the “Mail format” tab is not taken into account.
1) First, let's specify the destination address and subject of the email:
2) Next, let's specify the value of the body of the email:
To add line breaks, you must add the value <br>, a simple return to the line (Enter key) does not work.
You can also specify an HTML body with an HTML file (see example below).
3) Next, let's specify the value of the footer:
To add line breaks, you must add the value <br>, a simple return to the line (Enter key) does not work.
You can also specify an HTML body with an HTML file (see example below).
Note: If the “HTML body” and the “Body text” of the “Mail format” tab are both entered, only the “HTML body” will be taken into account.
Variant 6: Sending an email with an HTML body calling an external HTML file
This variant allows you to send a PDF by email containing an HTML body coming from an external HTML file. The biggest advantage of this option is that the HTML file can be generated and managed by a person outside Mapping (an HTML specialist for example and not a MAPPING specialist). Modifying the HTML file will have the effect of automatically modifying the content of the email sent by MAPPING, without affecting the processing rules.
1) First, let's specify the destination address and subject of the email:
2) Next, let's specify the body value of the HTML body via an external HTML file:
You can also specify an HTML body with an HTML file (see example below).
3) Next, let's specify the value of the footer:
Note : We can also put dynamic data in the HTML file using the [[ ]] syntax for indexes or [% %] for environment variables.
Example: Hello Mr [%NAME%],
Variant 7: Sending an email with an HTML body calling an external HTML file with variable data
This variant allows you to send a PDF by email containing an HTML body coming from an external HTML file. This HTML file contains dynamic values coming from indexes of the input XPS file and parameters initialized via data from the input file or other.
Consider the following workflow:
1) For our example, let’s create and initialize an environment variable “NAME” with the value “Jérôme DIEU”
2) For our example, let's create and initialize an index "INVOICE" with the value "INV_2018050001
3) Let's convert and send the PDF using the HTML file having the content as below:
Dear [%NOM%],
Please find enclosed your invoice N°[[INVOICE]]
Best regards
Here is the call for the HTML file:
The received email has the content of the HTML file as body.
Variant 8: Sending an email with an HTML body calling a dynamic external HTML file based on a company code
This variant allows you to send a PDF by email containing an HTML body coming from an external HTML file. This HTML body is variable and is based on the company code received in the input file.
Consider the following workflow:
1) For this example, you must have 2 HTML files, an HTML file for company 1 (COMP1.html containing the logo of company 1 for example and other information unique to this company 1) and another HTML file for company 2 (COMP2.html containing the logo of company 2 other information unique to this company 2)
2)For our example, let's create and initialize an environment variable "COMPANY_ID" with the value of the company code (coming for example from the input file via a rulefile): In our example, I hard initialize it to "COMP1 »
3)Next, let’s create and initialize an environment variable “NAME” with the value “Jérôme DIEU”
4)For our example, let's create and initialize an index "INVOICE" with the value "INV_2018050001"
Here is the call for the HTML file The email received has the content of the HTML file as body
5)Let's convert and send the PDF using the HTML file having the content as below:
Here the HTML file is called dynamically according to the COMPANY_ID value.
Notes
1) It is possible to enter several recipients in blind copy with each address separated by a semicolon “; ".
2) If the “HTML body” and the “Body text” of the “Mail format” tab are both entered, only the “HTML body” will be taken into account.
3) To write a body you must use the HTML body (present in the second tab), if you use the “Body text” from the “Mail format” tab, the body will be absent.