ComposantsComponents

ComposantsComponents › Fichier › LectureFile › Input

tFileInputMail

tFileInputMail

Fichier › LectureFile › Input

Lit un courriel enregistré dans un fichier, au format MIME (.eml) ou Outlook (.msg), et en tire une ligne : expéditeur, destinataires, objet, date, en-têtes personnalisés, corps du message. Ses pièces jointes sont enregistrées dans un dossier. Un fichier donne une seule ligne : pour tout un dossier de messages, placez-le derrière un tFileList. Le composant ne se connecte à aucun serveur de messagerie. Reads an email saved in a file, in MIME (.eml) or Outlook (.msg) format, and turns it into one row: sender, recipients, subject, date, custom headers, message body. Its attachments are saved into a folder. A file gives a single row: for a whole folder of messages, put it after a tFileList. The component connects to no mail server.

EntréeInput

Aucune : il commence son sous-job. Sinon un lien Iterate : il lit un fichier à chaque itération.None: it starts its subjob. Otherwise one Iterate link: it reads one file at each iteration.

SortieOutput

Main une ligne par fichier luone row per file read

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Lire un dossier de messagesRead a folder of messages

Iterate row1 (Main) tFileList_1 tFileInputMail_1 tLogRow_1

Le tFileList trouve les .eml ; le tFileInputMail lit le fichier courant, ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")), et envoie sa ligne au tLogRow. Chaque colonne du schéma reçoit une partie du message, choisie dans le tableau Parties de l'e-mail. The tFileList finds the .eml files; the tFileInputMail reads the current file, ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")), and sends its row to the tLogRow. Each schema column receives one part of the message, chosen in the Mail parts table.

Les parties d'un message MIMEThe parts of a MIME message

  • "Body" : le texte du message, décodé (quoted-printable, base64, jeu de caractères). Un message en plusieurs parties a souvent deux textes, brut et HTML : cochez Multi valeur (voir l'exemple)."Body": the message text, decoded (quoted-printable, base64, character set). A multipart message often has two texts, plain and HTML: check Multi Value (see the example).
  • "Header" : toutes les lignes d'en-tête, jointes par le séparateur."Header": all the header lines, joined with the separator.
  • Tout autre nom : l'en-tête de ce nom ("From", "To", "Subject", "Date", "X-…", casse ignorée), mots encodés (=?UTF-8?Q?…?=) décodés.Any other name: the header of that name ("From", "To", "Subject", "Date", "X-…", case ignored), encoded words (=?UTF-8?Q?…?=) decoded.
  • Chaque partie qui a un nom de fichier est enregistrée dans le dossier des pièces jointes.Each part that has a file name is saved into the attachment folder.
  1. Déposez le tFileInputMail depuis la famille Fichier › Lecture de la palette. Drop the tFileInputMail from the File › Input family of the palette.
  2. Indiquez le Nom de fichier, le Type d'e-mail (MIME pour un .eml, MSG pour un .msg d'Outlook) et le dossier des pièces jointes. Set the File Name, the Mail type (MIME for an .eml, MSG for an Outlook .msg) and the attachment folder.
  3. Modifiez le schéma : une colonne par partie à lire, String sauf exception. Edit the schema: one column per part to read, String unless otherwise needed.
  4. Dans le tableau des parties, donnez à chaque colonne sa partie : en MIME, une expression Java ("Subject") ; en MSG, un choix de la liste. Aucune ligne ne doit rester vide (voir les erreurs). In the parts table, give each column its part: in MIME, a Java expression ("Subject"); in MSG, a choice from the list. No row may stay empty (see the errors).
  5. Reliez la sortie (clic droit › Ligne › Main) au composant suivant. Connect the output (right-click › Row › Main) to the next component.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings.

ParamètreSetting DéfautDefault VisibleShown Description
Nom de fichierFile NameFILENAME chemin par défaut + /01234.maildefault path + /01234.mail ToujoursAlways Le fichier du message, en expression Java. L'extension ne compte pas : c'est le Type d'e-mail qui dit comment le lire. The message file, as a Java expression. The extension does not matter: the Mail type tells how to read it.
SchémaSchemaSCHEMA videempty ToujoursAlways Une colonne par partie lue ; leur nom est libre. En MIME, une colonne d'un autre type que String est convertie (une date selon son modèle, voir l'exemple). En MSG, seuls les types String, Date, Object et List compilent. One column per part read; their name is free. In MIME, a column of another type than String is converted (a date with its pattern, see the example). In MSG, only the String, Date, Object and List types compile.
Type d'e-mailMail typeMAIL_TYPE MIME ToujoursAlways MIME : un message Internet (.eml, export d'un client de messagerie), lu par JavaMail. MSG : un message enregistré par Outlook (.msg), lu par Apache POI. MIME: an Internet message (.eml, export from a mail client), read by JavaMail. MSG: a message saved by Outlook (.msg), read by Apache POI.
Répertoire d'export des pièces jointesAttachment export directoryATTACHMENT_PATH chemin par défautdefault path ToujoursAlways Le dossier où les pièces jointes sont enregistrées ; il est créé s'il n'existe pas, même pour un message sans pièce jointe. Un fichier déjà présent n'est jamais remplacé : la nouvelle copie prend un suffixe, report_2.csv, report_3.csv… (voir l'exemple). The folder where the attachments are saved; it is created if it does not exist, even for a message without attachment. A file already there is never replaced: the new copy gets a suffix, report_2.csv, report_3.csv… (see the example).
Parties de l'e-mailMail partsMAIL_PARTS partie vide, décochée, ""empty part, unchecked, "" Type MIMEType MIME Une ligne par colonne du schéma. Partie de l'e-mail : expression Java, "Body", "Header" ou le nom d'un en-tête ; à remplir pour chaque colonne. Multi valeur : pour un en-tête, toutes ses occurrences et pas seulement la première ; pour "Body", tous les textes dans la même colonne. Séparateur : expression Java écrite après chaque valeur, la dernière comprise (voir les exemples). One row per schema column. Mail part: Java expression, "Body", "Header" or the name of a header; to fill for each column. Multi Value: for a header, all its occurrences and not only the first one; for "Body", all the texts in the same column. Separator: Java expression written after each value, the last one included (see the examples).
Parties du message de l'e-mailMSG Mail partsMSG_MAIL_PARTS From Type MSGType MSG Une ligne par colonne du schéma, avec une partie de la liste : From (nom affiché de l'expéditeur), To, CC, BCC (noms affichés), Subject, Body, HtmlBody, RtfBody, ConversationTopic, MessageDate (une date), RecipientAddress et RecipientNames (joints par ; ), RecipientAddressList et RecipientNamesList (des tableaux, pour une colonne List). Voir l'exemple. One row per schema column, with a part from the list: From (display name of the sender), To, CC, BCC (display names), Subject, Body, HtmlBody, RtfBody, ConversationTopic, MessageDate (a date), RecipientAddress and RecipientNames (joined with ; ), RecipientAddressList and RecipientNamesList (arrays, for a List column). See the example.
Arrêter en cas d'erreurDie on errorDIE_ON_ERROR OuiYes ToujoursAlways Cochée, une erreur (fichier absent, partie introuvable, valeur non convertible) arrête le job. Décochée, le message Exception in component … part sur la sortie d'erreur et le job continue ; en MIME, aucune ligne n'est envoyée, en MSG une ligne incomplète peut l'être (voir les erreurs). Checked, an error (missing file, part not found, value that does not convert) stops the job. Unchecked, the Exception in component … message goes to the error output and the job goes on; in MIME, no row is sent, in MSG an incomplete one can be (see the errors).

Variable globaleGlobal variable

EXPORTED_FILE_PATH (String, disponible dès le début du composant, donc dans le flux) : le dossier des pièces jointes, terminé par /. Il ne donne pas les noms des fichiers enregistrés. Le composant n'a pas de NB_LINE : il envoie une ligne par fichier lu. EXPORTED_FILE_PATH (String, available from the start of the component, so in the flow): the attachment folder, ending with /. It does not give the names of the saved files. The component has no NB_LINE: it sends one row per file read.

((String) globalMap.get("tFileInputMail_1_EXPORTED_FILE_PATH"))

ExemplesExamples

Le tFileInputMail_1 lit un message du dossier donné par la variable de contexte folder ; les pièces jointes vont dans context.folder + "/attachments". Toutes les colonnes sont des String, sauf mention contraire. Les messages sont fictifs (adresses en example.com), avec des fins de ligne CRLF. Les sorties sont celles de la console, copiées depuis une exécution du job ; le dossier de travail y est remplacé par C:/data. tFileInputMail_1 reads a message of the folder given by the folder context variable; the attachments go to context.folder + "/attachments". All columns are String, unless stated otherwise. The messages are fictitious (example.com addresses), with CRLF line ends. The outputs are the console ones, copied from a run of the job; the working folder is replaced with C:/data in them.

Lire les en-têtesRead the headers

Le fichier welcome.eml : expéditeur et objet encodés (RFC 2047), corps en quoted-printable, destinataires To repliés sur deux lignes. The welcome.eml file: sender and subject encoded (RFC 2047), body in quoted-printable, To recipients folded over two lines.

Return-Path: <helene@example.com>
Received: from mail.example.com (mail.example.com [192.0.2.10])
	by mx.example.com with ESMTP id 4F2A1; Thu, 12 Nov 2026 09:30:02 +0100
Message-ID: <20261112093000.4F2A1@example.com>
Date: Thu, 12 Nov 2026 09:30:00 +0100
From: =?UTF-8?Q?H=C3=A9l=C3=A8ne_Boucher?= <helene@example.com>
To: Ada Lovelace <ada@example.com>,
 grace@example.com
Cc: "Support, Example" <support@example.com>
Subject: =?UTF-8?B?Q29tcHRlLXJlbmR1IGRlIGxhIHLDqXVuaW9u?=
X-Ticket: T-1042
X-Tag: meeting
X-Tag: minutes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Bonjour,

Voici le compte-rendu de la r=C3=A9union de jeudi : budget valid=C3=A9, =
prochaine r=C3=A9union le 19 novembre.

H=C3=A9l=C3=A8ne
row1 (Main) tFileInputMail_1 tLogRow_1

Nom de fichier context.folder + "/mail/welcome.eml", type MIME. Parties (tLogRow_1 en mode Vertical) : File Name context.folder + "/mail/welcome.eml", MIME type. Parts (tLogRow_1 in Vertical mode):

ColonneColumn Partie de l'e-mailMail part Multi valeurMulti Value
from"From"–
to"To"–
cc"Cc"–
subject"Subject"–
date"Date"–
ticket"X-Ticket"–
.---------------------------------------------------------------.
|                         #1. tLogRow_1                         |
+---------+-----------------------------------------------------+
| key     | value                                               |
+---------+-----------------------------------------------------+
| from    | Hélène Boucher <helene@example.com>                 |
| to      | Ada Lovelace <ada@example.com>,
 grace@example.com |
| cc      | "Support, Example" <support@example.com>            |
| subject | Compte-rendu de la réunion                          |
| date    | Thu, 12 Nov 2026 09:30:00 +0100                     |
| ticket  | T-1042                                              |
+---------+-----------------------------------------------------+
  • L'expéditeur et l'objet sont décodés ; les adresses restent telles qu'écrites, avec leur nom.The sender and the subject are decoded; the addresses stay as written, with their name.
  • Un en-tête replié garde son retour à la ligne : la valeur de to contient un CRLF suivi d'une espace, qui décale le cadre.A folded header keeps its line break: the to value holds a CRLF followed by a space, which shifts the frame.

Corps du messageMessage body

Le même welcome.eml, parties subject ("Subject"), body ("Body"), from ("From"). Un tJavaRow remplace le tLogRow et affiche les valeurs entre crochets : The same welcome.eml, parts subject ("Subject"), body ("Body"), from ("From"). A tJavaRow replaces the tLogRow and prints the values between brackets:

System.out.println("subject: " + input_row.subject);
System.out.println("body: [" + input_row.body + "]");
System.out.println("from: [" + input_row.from + "]");
subject: Compte-rendu de la réunion
body: [Bonjour,

Voici le compte-rendu de la réunion de jeudi : budget validé, prochaine réunion le 19 novembre.

Hélène
]
from: [Hélène Boucher <helene@example.com>]

Le quoted-printable est décodé avec le jeu de caractères du message (UTF-8) ; la coupure = en fin de ligne est recollée. Le corps garde sa dernière fin de ligne. The quoted-printable is decoded with the character set of the message (UTF-8); the = break at the end of the line is joined back. The body keeps its last line end.

Multi valeur et en-tête completMulti Value and full header

Le même welcome.eml, qui a deux en-têtes X-Tag. Parties : tag ("X-Tag"), tags ("X-Tag", Multi valeur coché, séparateur "|"), headers ("Header", séparateur "\n"). Même tJavaRow : The same welcome.eml, which has two X-Tag headers. Parts: tag ("X-Tag"), tags ("X-Tag", Multi Value checked, separator "|"), headers ("Header", separator "\n"). Same tJavaRow:

tag: [meeting]
tags: [meeting|minutes|]
headers: [Return-Path: <helene@example.com>
Received: from mail.example.com (mail.example.com [192.0.2.10])
	by mx.example.com with ESMTP id 4F2A1; Thu, 12 Nov 2026 09:30:02 +0100
Message-ID: <20261112093000.4F2A1@example.com>
Date: Thu, 12 Nov 2026 09:30:00 +0100
From: Hélène Boucher <helene@example.com>
To: Ada Lovelace <ada@example.com>,
 grace@example.com
Cc: "Support, Example" <support@example.com>
Subject: Compte-rendu de la réunion
X-Ticket: T-1042
X-Tag: meeting
X-Tag: minutes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
]
  • Sans Multi valeur, seule la première occurrence est lue.Without Multi Value, only the first occurrence is read.
  • Le séparateur suit chaque valeur, la dernière comprise : meeting|minutes|, et une fin de ligne après le dernier en-tête.The separator follows each value, the last one included: meeting|minutes|, and a line end after the last header.
  • "Header" donne les lignes d'en-tête dans l'ordre du fichier, mots encodés décodés."Header" gives the header lines in the order of the file, encoded words decoded.

Message en plusieurs parties et pièces jointesMultipart message and attachments

Le fichier report.eml : un texte brut (ISO-8859-1) et sa version HTML (UTF-8), puis deux pièces jointes, dont une au nom encodé. The report.eml file: a plain text (ISO-8859-1) and its HTML version (UTF-8), then two attachments, one with an encoded name.

Message-ID: <20261113170500.77B3C@example.com>
Date: Fri, 13 Nov 2026 17:05:00 +0100
From: Grace Hopper <grace@example.com>
To: Ada Lovelace <ada@example.com>
Subject: Weekly report
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="mixed-1"

This is a multi-part message in MIME format.

--mixed-1
Content-Type: multipart/alternative; boundary="alt-1"

--alt-1
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello Ada,
The weekly report is attached. Caf=E9 at 10?
Grace
--alt-1
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p>Hello Ada,<br>The weekly report is attached. Caf=C3=A9 at 10?<br>Grace</p>
--alt-1--

--mixed-1
Content-Type: text/csv; name="report.csv"
Content-Disposition: attachment; filename="report.csv"
Content-Transfer-Encoding: base64

d2Vlazt0aWNrZXRzDQo0NTsxMg0KNDY7OQ0K
--mixed-1
Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?Q?r=C3=A9sum=C3=A9.txt?="
Content-Disposition: attachment; filename="=?UTF-8?Q?r=C3=A9sum=C3=A9.txt?="
Content-Transfer-Encoding: quoted-printable

R=C3=A9sum=C3=A9 de la semaine.
--mixed-1--
row1 (Main) OnSubjobOk tFileInputMail_1 tJavaRow_1 tJava_1

Parties subject, body ("Body"), from, et le même tJavaRow. Le tJava liste ensuite le dossier des pièces jointes : Parts subject, body ("Body"), from, and the same tJavaRow. The tJava then lists the attachment folder:

java.io.File[] files = new java.io.File(context.folder + "/attachments").listFiles();
java.util.Arrays.sort(files);
for (java.io.File f : files) {
    System.out.println(f.getName() + " (" + f.length() + " bytes)");
}
System.out.println("EXPORTED_FILE_PATH: " + globalMap.get("tFileInputMail_1_EXPORTED_FILE_PATH"));

body sans Multi valeur :body without Multi Value:

subject: Weekly report
body: [Hello Ada,
The weekly report is attached. Café at 10?
Grace]
from: [<p>Hello Ada,<br>The weekly report is attached. Café at 10?<br>Grace</p>]
report.csv (27 bytes)
résumé.txt (23 bytes)
EXPORTED_FILE_PATH: C:/data/attachments/

body avec Multi valeur coché, séparateur "\n----\n", exécuté une seconde fois :body with Multi Value checked, separator "\n----\n", run a second time:

subject: Weekly report
body: [Hello Ada,
The weekly report is attached. Café at 10?
Grace
----
<p>Hello Ada,<br>The weekly report is attached. Café at 10?<br>Grace</p>
----
]
from: [Grace Hopper <grace@example.com>]
report.csv (27 bytes)
report_2.csv (27 bytes)
résumé.txt (23 bytes)
résumé_2.txt (23 bytes)
EXPORTED_FILE_PATH: C:/data/attachments/
  • Chaque texte est décodé avec son propre jeu de caractères : Café est juste dans les deux.Each text is decoded with its own character set: Café is right in both.
  • Les pièces jointes sont enregistrées sous leur nom décodé (résumé.txt). À la seconde exécution, les fichiers déjà là sont gardés et les nouvelles copies prennent _2.The attachments are saved under their decoded name (résumé.txt). At the second run, the files already there are kept and the new copies get _2.
Défaut du modèle. Sans Multi valeur, chaque texte du corps prend la place d'une colonne : le texte brut va dans body, le HTML dans from, et la vraie valeur de from est perdue. Le modèle (tFileInputMail_MIME.javajet, lignes 75 à 101) ajoute un élément par partie texte à la liste dont il tire les colonnes par leur rang. Cochez toujours Multi valeur pour "Body", ou placez "Body" en dernière colonne. Template defect. Without Multi Value, each text of the body takes the place of a column: the plain text goes into body, the HTML into from, and the real from value is lost. The template (tFileInputMail_MIME.javajet, lines 75 to 101) adds one item per text part to the list it takes the columns from by rank. Always check Multi Value for "Body", or put "Body" as the last column.

Image dans le corpsImage in the body

Le fichier newsletter.eml : un HTML qui affiche une image jointe inline. The newsletter.eml file: an HTML that shows an image attached inline.

Date: Sat, 14 Nov 2026 08:00:00 +0100
From: Example News <news@example.com>
To: ada@example.com
Subject: Our new logo
MIME-Version: 1.0
Content-Type: multipart/related; boundary="rel-1"

--rel-1
Content-Type: multipart/alternative; boundary="alt-2"

--alt-2
Content-Type: text/plain; charset=UTF-8

Here is our new logo.
--alt-2
Content-Type: text/html; charset=UTF-8

<p>Here is our new logo: <img src="cid:logo@example.com"></p>
--alt-2--

--rel-1
Content-Type: image/png; name="logo.png"
Content-Disposition: inline; filename="logo.png"
Content-ID: <logo@example.com>
Content-Transfer-Encoding: base64

iVBORw0KGgo=
--rel-1--

Mêmes parties, body en Multi valeur, même tJavaRow et même tJava : Same parts, body as Multi Value, same tJavaRow and same tJava:

subject: Our new logo
body: [Here is our new logo.
----
<p>Here is our new logo: <img src="cid:logo@example.com"></p>
----
com.sun.mail.util.BASE64DecoderStream@7f9a81e8
----
]
from: [Example News <news@example.com>]
logo.png (8 bytes)
EXPORTED_FILE_PATH: C:/data/attachments/
Défaut du modèle. L'image inline est bien enregistrée, mais elle est aussi ajoutée au corps sous la forme du nom d'un objet Java (com.sun.mail.util.BASE64DecoderStream@…) : le modèle (tFileInputMail_MIME.javajet, lignes 119 à 124) prend le contenu de toute partie inline comme du texte. Sans Multi valeur, cette valeur décale aussi les colonnes. Template defect. The inline image is saved, but it is also added to the body as the name of a Java object (com.sun.mail.util.BASE64DecoderStream@…): the template (tFileInputMail_MIME.javajet, lines 119 to 124) takes the content of any inline part as text. Without Multi Value, this value also shifts the columns.

Lire tout un dossierRead a whole folder

Iterate row1 (Main) OnSubjobOk tFileList_1 tFileInputMail_1 tLogRow_1 tJava_1

Le tFileList_1 parcourt context.folder + "/mail", masque "*.eml", trié par nom. Nom de fichier du tFileInputMail_1 : ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) ; parties from, subject, date. Le tJava_1 affiche tFileList_1_NB_FILE. tFileList_1 goes through context.folder + "/mail", mask "*.eml", sorted by name. File Name of tFileInputMail_1: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")); parts from, subject, date. tJava_1 prints tFileList_1_NB_FILE.

.--------------------------------+-------------+-------------------------------.
|                                  tLogRow_1                                   |
|=-------------------------------+-------------+------------------------------=|
|from                            |subject      |date                           |
|=-------------------------------+-------------+------------------------------=|
|Grace Hopper <grace@example.com>|Weekly report|Fri, 13 Nov 2026 17:05:00 +0100|
'--------------------------------+-------------+-------------------------------'

.-----------------------------------+--------------------------+-------------------------------.
|                                          tLogRow_1                                           |
|=----------------------------------+--------------------------+------------------------------=|
|from                               |subject                   |date                           |
|=----------------------------------+--------------------------+------------------------------=|
|Hélène Boucher <helene@example.com>|Compte-rendu de la réunion|Thu, 12 Nov 2026 09:30:00 +0100|
'-----------------------------------+--------------------------+-------------------------------'

tFileList_1_NB_FILE: 2

Une ligne par message. Le tLogRow est dans la boucle : en mode Table, il affiche un tableau par itération. One row per message. The tLogRow is in the loop: in Table mode, it prints one table per iteration.

L'en-tête Date dans une colonne DateThe Date header in a Date column

OnSubjobOk row1 (Main) tJava_1 tFileInputMail_1 tLogRow_1

welcome.eml, parties subject et sent ("Date"), colonne Date de modèle "EEE, d MMM yyyy HH:mm:ss Z". Le tJava_1 affiche la langue de la JVM : System.out.println("Locale: " + java.util.Locale.getDefault());. Exécuté sur un poste en français, puis avec les arguments de JVM -Duser.language=en -Duser.country=US (onglet Exécuter › Paramètres avancés). welcome.eml, parts subject and sent ("Date"), Date column with pattern "EEE, d MMM yyyy HH:mm:ss Z". tJava_1 prints the JVM language: System.out.println("Locale: " + java.util.Locale.getDefault());. Run on a French computer, then with the JVM arguments -Duser.language=en -Duser.country=US (Run tab › Advanced settings).

Locale: fr_FR
Exception in component tFileInputMail_1 (MyJob)
java.lang.RuntimeException: Unparseable date: "Thu, 12 Nov 2026 09:30:00 +0100"
	at routines.system.ParserUtils.parseTo_Date(ParserUtils.java:342)
	…
Locale: en_US
.--------------------------+-------------------------------.
|                        tLogRow_1                         |
|=-------------------------+------------------------------=|
|subject                   |sent                           |
|=-------------------------+------------------------------=|
|Compte-rendu de la réunion|Thu, 12 Nov 2026 09:30:00 +0100|
'--------------------------+-------------------------------'

Le jour et le mois sont en anglais dans un courriel ; la conversion se fait dans la langue de la JVM. Sur un poste qui n'est pas en anglais, lisez la date en String, ou donnez ces arguments à la JVM du job. The day and the month are in English in an email; the conversion is done in the JVM language. On a computer that is not in English, read the date as String, or give these arguments to the job JVM.

Message Outlook (.msg)Outlook message (.msg)

OnSubjobOk row1 (Main) OnSubjobOk tJava_1 tFileInputMail_1 tLogRow_1 tJava_2

Le fichier planning.msg est un message fictif, fabriqué pour l'exemple par le tJava_1 avec la bibliothèque Apache POI, que le type MSG ajoute au job. Il contient : objet et sujet de conversation Planning for December ; expéditeur Ada Lovelace ; To affiché Grace Hopper; Alan Turing, CC affiché Hélène Boucher, BCC vide ; trois destinataires avec leur adresse ; un corps texte et un corps HTML, pas de corps RTF ; date d'envoi le 12/11/2026 à 09:30 (+01:00) ; une pièce jointe planning.csv de 44 octets. Le tJava_2 liste le dossier des pièces jointes, comme plus haut. The planning.msg file is a fictitious message, made for the example by tJava_1 with the Apache POI library, which the MSG type adds to the job. It holds: subject and conversation topic Planning for December; sender Ada Lovelace; displayed To Grace Hopper; Alan Turing, displayed CC Hélène Boucher, empty BCC; three recipients with their address; a text body and an HTML body, no RTF body; sent on 12/11/2026 at 09:30 (+01:00); one 44-byte planning.csv attachment. tJava_2 lists the attachment folder, as above.

Code du tJava_1 qui fabrique le messageCode of tJava_1 that makes the message
java.io.File msgFile = new java.io.File(context.folder + "/msg/planning.msg");
msgFile.getParentFile().mkdirs();
class MsgWriter {
    void text(org.apache.poi.poifs.filesystem.DirectoryEntry dir, String tag, String value) throws java.io.IOException {
        dir.createDocument("__substg1.0_" + tag + "001F", new java.io.ByteArrayInputStream(value.getBytes(java.nio.charset.StandardCharsets.UTF_16LE)));
    }
    void bytes(org.apache.poi.poifs.filesystem.DirectoryEntry dir, String tag, byte[] value) throws java.io.IOException {
        dir.createDocument("__substg1.0_" + tag + "0102", new java.io.ByteArrayInputStream(value));
    }
}
MsgWriter w = new MsgWriter();
org.apache.poi.poifs.filesystem.POIFSFileSystem fs = new org.apache.poi.poifs.filesystem.POIFSFileSystem();
org.apache.poi.poifs.filesystem.DirectoryEntry root = fs.getRoot();
w.text(root, "001A", "IPM.Note");
w.text(root, "0037", "Planning for December");
w.text(root, "0070", "Planning for December");
w.text(root, "0C1A", "Ada Lovelace");
w.text(root, "0C1F", "ada@example.com");
w.text(root, "0E04", "Grace Hopper; Alan Turing");
w.text(root, "0E03", "Hélène Boucher");
w.text(root, "0E02", "");
w.text(root, "1000", "Hello Grace, hello Alan,\r\nThe planning for December is attached.\r\nAda");
w.text(root, "1013", "<p>Hello Grace, hello Alan,<br>The planning for December is attached.<br>Ada</p>");
java.nio.ByteBuffer p = java.nio.ByteBuffer.allocate(32 + 16).order(java.nio.ByteOrder.LITTLE_ENDIAN);
p.putLong(0L); p.putInt(3); p.putInt(1); p.putInt(3); p.putInt(1); p.putLong(0L);
p.putShort((short) 0x0040); p.putShort((short) 0x0039); p.putInt(6);
long ms = java.time.OffsetDateTime.parse("2026-11-12T09:30:00+01:00").toInstant().toEpochMilli();
p.putLong((ms + 11644473600000L) * 10000L);
root.createDocument("__properties_version1.0", new java.io.ByteArrayInputStream(p.array()));
String[][] recipients = {{"Grace Hopper", "grace@example.com"}, {"Alan Turing", "alan@example.com"}, {"Hélène Boucher", "helene@example.com"}};
for (int i = 0; i < recipients.length; i++) {
    org.apache.poi.poifs.filesystem.DirectoryEntry r = root.createDirectory(String.format("__recip_version1.0_#%08X", i));
    w.text(r, "3001", recipients[i][0]);
    w.text(r, "39FE", recipients[i][1]);
    w.text(r, "3003", recipients[i][1]);
}
org.apache.poi.poifs.filesystem.DirectoryEntry a = root.createDirectory("__attach_version1.0_#00000000");
w.text(a, "3704", "PLANNI~1.CSV");
w.text(a, "3707", "planning.csv");
w.text(a, "3703", ".csv");
w.bytes(a, "3701", "day;who\r\n2026-12-01;Grace\r\n2026-12-02;Alan\r\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));
try (java.io.OutputStream out = new java.io.FileOutputStream(msgFile)) {
    fs.writeFilesystem(out);
}
fs.close();
System.out.println("planning.msg: " + msgFile.length() + " bytes");

Type MSG. Parties : from From, to To, cc CC, subject Subject, topic ConversationTopic, sent MessageDate (Date, modèle "dd-MM-yyyy HH:mm"), addresses RecipientAddress, names RecipientNames, addressList RecipientAddressList (List), nameList RecipientNamesList (String). tLogRow_1 en mode Vertical : MSG type. Parts: from From, to To, cc CC, subject Subject, topic ConversationTopic, sent MessageDate (Date, pattern "dd-MM-yyyy HH:mm"), addresses RecipientAddress, names RecipientNames, addressList RecipientAddressList (List), nameList RecipientNamesList (String). tLogRow_1 in Vertical mode:

planning.msg: 7680 bytes
.-------------------------------------------------------------------------.
|                              #1. tLogRow_1                              |
+-------------+-----------------------------------------------------------+
| key         | value                                                     |
+-------------+-----------------------------------------------------------+
| from        | Ada Lovelace                                              |
| to          | Grace Hopper; Alan Turing                                 |
| cc          | Hélène Boucher                                            |
| subject     | Planning for December                                     |
| topic       | Planning for December                                     |
| sent        | 12-11-2026 09:30                                          |
| addresses   | grace@example.com; alan@example.com; helene@example.com   |
| names       | Grace Hopper; Alan Turing; Hélène Boucher                 |
| addressList | [grace@example.com, alan@example.com, helene@example.com] |
| nameList    | [Ljava.lang.String;@4b741d6d                              |
+-------------+-----------------------------------------------------------+

planning.csv (44 bytes)
EXPORTED_FILE_PATH: C:/data/attachments/

Parties subject Subject, body Body, html HtmlBody, affichées par un tJavaRow ; exécuté une seconde fois : Parts subject Subject, body Body, html HtmlBody, printed by a tJavaRow; run a second time:

planning.msg: 7680 bytes
subject: Planning for December
body: [Hello Grace, hello Alan,
The planning for December is attached.
Ada]
html: [<p>Hello Grace, hello Alan,<br>The planning for December is attached.<br>Ada</p>]
planning.csv (44 bytes)
planning_2.csv (44 bytes)
EXPORTED_FILE_PATH: C:/data/attachments/
  • From, To et CC donnent les noms affichés, pas les adresses : celles des destinataires sont dans RecipientAddress. L'adresse de l'expéditeur n'est pas proposée.From, To and CC give the display names, not the addresses: the recipients' ones are in RecipientAddress. The sender address is not offered.
  • Les parties …List sont des tableaux : dans une colonne List, ils donnent une liste ; dans une colonne String, le nom d'un objet Java ([Ljava.lang.String;@…).The …List parts are arrays: in a List column, they give a list; in a String column, the name of a Java object ([Ljava.lang.String;@…).
  • Les pièces jointes prennent, elles aussi, un suffixe _2 plutôt que de remplacer un fichier.The attachments also get a _2 suffix rather than replacing a file.

Erreurs et piègesErrors and pitfalls

Mêmes jobs que dans les exemples. Le nom du job est remplacé par MyJob, le dossier de travail par C:\data ; les traces sont abrégées. La fin des messages d'exception vient de Windows, dans sa langue. Same jobs as in the examples. The job name is replaced with MyJob, the working folder with C:\data; traces are shortened. The end of the exception messages comes from Windows, in its language.

Fichier absentMissing file

Nom de fichier context.folder + "/mail/missing.eml", un tJava relié par On Subjob Ok qui affiche after. Avec Arrêter en cas d'erreur (défaut), le job s'arrête (code 1) : File name context.folder + "/mail/missing.eml", a tJava connected with On Subjob Ok that prints after. With Die on error (default), the job stops (exit code 1):

Exception in component tFileInputMail_1 (MyJob)
java.io.FileNotFoundException: C:\data\mail\missing.eml (Le fichier spécifié est introuvable)
	at java.base/java.io.FileInputStream.open0(Native Method)
	…

Case décochée, le message part sur la sortie d'erreur, aucune ligne n'est envoyée et le job continue : Box unchecked, the message goes to the error output, no row is sent and the job goes on:

Exception in component tFileInputMail_1: C:\data\mail\missing.eml (Le fichier spécifié est introuvable)
after

Partie laissée vide : le job ne compile pasPart left empty: the job does not compile

Type MIME, deux colonnes : subject ("Subject") et other, dont la Partie de l'e-mail est restée vide. Le modèle écrit la partie telle quelle dans le code : il reste une virgule seule. MIME type, two columns: subject ("Subject") and other, whose Mail part stayed empty. The template writes the part as it is into the code: a lone comma is left.

MyJob.java:856: error: illegal start of expression
			,
			^
1 error

Donnez une partie à chaque colonne, ou retirez la colonne du schéma. Give a part to each column, or remove the column from the schema.

MSG : partie absente du messageMSG: part missing from the message

planning.msg, qui n'a pas de corps RTF. Parties subject Subject, from From, rtf RtfBody, body Body. Avec Arrêter en cas d'erreur, le job s'arrête : planning.msg, which has no RTF body. Parts subject Subject, from From, rtf RtfBody, body Body. With Die on error, the job stops:

Exception in component tFileInputMail_1 (MyJob)
org.apache.poi.hsmf.exceptions.ChunkNotFoundException: Chunk not found
	at org.apache.poi.hsmf.MAPIMessage.getRtfBody(MAPIMessage.java:257)
	at org.talend.msg.utils.MsgMailUtil.processMessage(MsgMailUtil.java:133)
	…

Case décochée, une ligne part quand même, incomplète : Box unchecked, a row goes out anyway, incomplete:

Exception in component tFileInputMail_1: Chunk not found
.---------------------------------.
|          #1. tLogRow_1          |
+---------+-----------------------+
| key     | value                 |
+---------+-----------------------+
| subject | Planning for December |
| from    | Ada Lovelace          |
| rtf     | null                  |
| body    | null                  |
+---------+-----------------------+
Défaut du modèle. body est null alors que le message a un corps : la lecture s'arrête à la première partie absente, et la ligne est envoyée avec les colonnes lues avant (tFileInputMail_MSG.javajet, lignes 71 à 101). Ne demandez que les parties que tous vos messages ont. Template defect. body is null although the message has a body: reading stops at the first missing part, and the row is sent with the columns read before (tFileInputMail_MSG.javajet, lines 71 to 101). Only ask for the parts that all your messages have.

MSG : colonne byte[] ou IntegerMSG: byte[] or Integer column

Type MSG, une colonne body (Body) de type byte[], puis une colonne size (Body) de type Integer : MSG type, a body (Body) column of type byte[], then a size (Body) column of type Integer:

MyJob.java:1172: error: cannot find symbol
								row1.body = value_1_tFileInputMail_1.getBytes();
								                                    ^
  symbol:   method getBytes()
  location: variable value_1_tFileInputMail_1 of type Object
1 error
MyJob.java:1168: error: incompatible types: Object cannot be converted to String
								row1.size = ParserUtils.parseTo_Integer(value_1_tFileInputMail_1);
								                                        ^
1 error
Défaut du modèle. En MSG, la valeur lue est un Object, que le modèle passe sans conversion aux méthodes des types byte[] et des autres types (tFileInputMail_MSG.javajet, lignes 49 et 65) : seuls String, Date, Object et List compilent. Lisez en String, puis convertissez dans un tMap ou un tJavaRow. Template defect. In MSG, the read value is an Object, which the template passes without conversion to the methods of the byte[] and other types (tFileInputMail_MSG.javajet, lines 49 and 65): only String, Date, Object and List compile. Read as String, then convert in a tMap or a tJavaRow.

Conseils et limitesTips and limits

Body : Multi valeur, ou en dernierBody: Multi Value, or last

La plupart des courriels ont un texte brut et un texte HTML. Sans Multi valeur sur "Body", les colonnes qui suivent reçoivent les textes en trop. Avec, choisissez un séparateur que vous saurez retrouver pour séparer les deux textes ensuite. Most emails have a plain text and an HTML text. Without Multi Value on "Body", the following columns receive the extra texts. With it, choose a separator that you can find again to split the two texts afterwards.

En-têtes repliésFolded headers

Un en-tête long (liste de destinataires, objet) est souvent replié sur plusieurs lignes, et le composant garde les retours à la ligne. Pour une valeur sur une ligne, remplacez-les dans un tMap : row1.to.replaceAll("\\r?\\n[ \\t]+", " "). A long header (recipient list, subject) is often folded over several lines, and the component keeps the line breaks. For a one-line value, replace them in a tMap: row1.to.replaceAll("\\r?\\n[ \\t]+", " ").

Un dossier de pièces jointes par messageOne attachment folder per message

Tous les messages lus écrivent dans le même dossier, sans jamais remplacer un fichier : deux report.csv de deux messages deviennent report.csv et report_2.csv, sans dire lequel vient d'où. Derrière un tFileList, mettez le nom du message dans le chemin : context.folder + "/attachments/" + ((String)globalMap.get("tFileList_1_CURRENT_FILE")). All the read messages write into the same folder, never replacing a file: two report.csv from two messages become report.csv and report_2.csv, without telling which comes from where. After a tFileList, put the message name in the path: context.folder + "/attachments/" + ((String)globalMap.get("tFileList_1_CURRENT_FILE")).

Les noms des pièces jointesThe attachment names

EXPORTED_FILE_PATH ne donne que le dossier. Pour traiter les fichiers enregistrés, parcourez ce dossier avec un second tFileList après le sous-job de lecture. EXPORTED_FILE_PATH only gives the folder. To process the saved files, go through this folder with a second tFileList after the reading subjob.

Pas de serveur de messagerieNo mail server

Le composant lit des fichiers déjà enregistrés. Pour relever une boîte aux lettres, la palette a d'autres composants (tPOP), qui enregistrent les messages en .eml ; le tFileInputMail les lit ensuite. The component reads files already saved. To fetch a mailbox, the palette has other components (tPOP), which save the messages as .eml; tFileInputMail then reads them.

Les datesDates

En MIME, "Date" donne le texte de l'en-tête, en anglais : à lire en String sur un poste qui n'est pas en anglais (voir l'exemple). En MSG, MessageDate est déjà une date : prenez une colonne Date. In MIME, "Date" gives the header text, in English: read it as String on a computer that is not in English (see the example). In MSG, MessageDate is already a date: take a Date column.

Voir aussiSee also