
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
read-outlook-cg-lib
Advanced tools
This code has the objective of obtain the emails from the mailbox of a mail server account (like gmail, Outlook or Yahoo) through some parameters to perform the search, and take the data of the emails and format them so that they are readable for the user.
This library is useful to be implemented as a OIH based component to be executed into the N3xGen Portal. This components can be developed by their owners to get a specific list of emails from a specific account to display from the component.
Within "read-email-cg-lib" three additional libraries are used: imap: used to connect to the mail server through the IMAP protocol, which must be previously configured if the mail server needs it and is also used to search for mail through the parameters specified. mailparser: it is used to format the result of the "imap" library to make it easier the interpretation of the data. utils-nxg-cg: is used to print the necessary logs and other common tools.
As final result is a JSON object with the principal data of the email, if the email has attachments the files are going to be included as base64 encodig.
The library can be installed from npm page with the next:
npm install read-email-cg-lib, npm i read-email-cg-lib or yarn install read-email-cg-lib
This method searches for emails on a specific email server, the parameters that were defined are the ones that are taken to create the connection with the server and to search within an email account.
Arguments: The only and main method needs a list of parameters, some are mandatory and others are optional. The next are all the parameters listed with their description:
Result: As a result of the email search, the library creates an object array with the email data, where each object represents an email with its main attributes as shown in the next image:
note: the library is making an evaluation about this result in the order that the result has a JSON structure to be valid.
This part will shows some examples on how to send the input parameters to the library and what its result would be. In the next object is a valid object with full parameters that can be set to the library:
{
"user":"test@gmail.com",
"password":"1234",
"host":"imap.gmail.com",
"port":993,
"status":"ALL",
"startDate":"09/09/2022",
"endDate":"09/10/2022",
"dateFormat":"es-MX",
"sortDate":"desc"
}
In this case it is used a gmail account to get the all ("ALL") the emails from September 9th to September 10th, the date is set to Mexico format ("es-MX") and sorted in descending order ("desc") to get the newest first, the result should look like as follows:
[
{
"subject": "🇲🇽 ¡Venta de Independencia! En compras en cimaco.com 💻 Hasta 20% de descuento además hasta 18 Mensualidades sin Intereses 🥳",
"from": [
{
"address": "promociones.cimaco@cimaco.com.mx",
"name": "Promociones Cimaco"
}
],
"to": [
{
"address": "test@gmail.com",
"name": ""
}
],
"text": " En el caso de que no puedas visualizar este correo \nhttps://view.S6.exacttarget.com/?qs=5d56adc625948a3fe309f9eef3fc2b16ca207a4090b6ee2a97e826b8bdd9c553d92bfa00b43a148077e45213d41162f54f716aaaf166e0cedfa3930b44791d106b4a33ba63bf98b8 \n da un click aquí. \nPABLO,\n\n\nhttps://cl.s6.exct.net/?qs=f9986b09318b64f8e8a9f901e37f1d512184c3ea01a216bb54f352d6c1b9983e7c3e15b4d218124586b2d914b46c4169 \n\n\n\nAtención a Clientes: 800 224 6226\n\n800 A CIMACO\nCompañía Comercial Cimaco, S.A. de C.V.\n\nhttps://cl.s6.exct.net/?qs=f9986b09318b64f829b0795cf5019fe973fcf348fe30be39a2b2c20e9143cf3275e104ca1973f1054bb467ea13d812e1 \nHidalgo #399 Pte. Col Centro, C.P. 27000 Torreon Coahuila, Mexico. \n\n *No responder a este correo, es solo de envio.\n\nhttps://cl.S6.exct.net/unsub_center.aspx?qs=218508d0ef6920a6c2282e2e84fb97f415b64a42acfce668070f01d43a40348d5cd737d85d0653f9adff63bd1b1627ee0376ee57eb4d4b6e8a97a80b3522cd44 \nNo deseo recibir más promociones\n\n\n",
"date": "10/09/2022",
"attachments": null
},
{
"subject": "Prueba 1",
"from": [
{
"address": "correo1@hotmail.com",
"name": "pablo perez"
}
],
"to": [
{
"address": "test@gmail.com",
"name": ""
}
],
"text": "Mensaje de prueba para el correo\n\nEnviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows\n\n",
"date": "09/09/2022",
"attachments": null
}
]
In this example the sort is "desc" descending so first the mail of September 10th is listed. In this other example the sort parameter is set to "asc" ascending:
{
"user":"test@gmail.com",
"password":"1234",
"host":"imap.gmail.com",
"port":993,
"status":"ALL",
"startDate":"09/09/2022",
"endDate":"09/10/2022",
"dateFormat":"es-MX",
"sortDate":"asc",
"timeZone":"America/Los_Angeles"
}
So the result is going to be something like this:
[
{
"subject": "Prueba 1",
"from": [
{
"address": "correo1@hotmail.com",
"name": "pablo perez"
}
],
"to": [
{
"address": "test@gmail.com",
"name": ""
}
],
"text": "Mensaje de prueba para el correo\n\nEnviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows\n\n",
"date": "09/09/2022",
"attachments": null
},
{
"subject": "🇲🇽 ¡Venta de Independencia! En compras en cimaco.com 💻 Hasta 20% de descuento además hasta 18 Mensualidades sin Intereses 🥳",
"from": [
{
"address": "promociones.cimaco@cimaco.com.mx",
"name": "Promociones Cimaco"
}
],
"to": [
{
"address": "test@gmail.com",
"name": ""
}
],
"text": " En el caso de que no puedas visualizar este correo \nhttps://view.S6.exacttarget.com/?qs=5d56adc625948a3fe309f9eef3fc2b16ca207a4090b6ee2a97e826b8bdd9c553d92bfa00b43a148077e45213d41162f54f716aaaf166e0cedfa3930b44791d106b4a33ba63bf98b8 \n da un click aquí. \npablo,\n\n\nhttps://cl.s6.exct.net/?qs=f9986b09318b64f8e8a9f901e37f1d512184c3ea01a216bb54f352d6c1b9983e7c3e15b4d218124586b2d914b46c4169 \n\n\n\nAtención a Clientes: 800 224 6226\n\n800 A CIMACO\nCompañía Comercial Cimaco, S.A. de C.V.\n\nhttps://cl.s6.exct.net/?qs=f9986b09318b64f829b0795cf5019fe973fcf348fe30be39a2b2c20e9143cf3275e104ca1973f1054bb467ea13d812e1 \nHidalgo #399 Pte. Col Centro, C.P. 27000 Torreon Coahuila, Mexico. \n\n *No responder a este correo, es solo de envio.\n\nhttps://cl.S6.exct.net/unsub_center.aspx?qs=218508d0ef6920a6c2282e2e84fb97f415b64a42acfce668070f01d43a40348d5cd737d85d0653f9adff63bd1b1627ee0376ee57eb4d4b6e8a97a80b3522cd44 \nNo deseo recibir más promociones\n\n\n",
"date": "10/09/2022",
"attachments": null
}
]
Thaking first the September 9th (the oldest).
FAQs
Library to read emails from outlook accounts.
We found that read-outlook-cg-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.