Configuration
To configure IMAP mailbox, you need to create an ImapConfig
object in a file or a variable.
This is a configuration example, named here imap-config.js
.
- ESM
- CJS
/imap-config.js
const config = {
host: 'imap.server.domain',
port: 993,
auth: {
user: 'username@server.domain',
pass: 'password',
}
logger: false,
logging: true,
}
export config;
/imap-config.js
const config = {
host: 'imap.server.domain',
port: 993,
auth: {
user: 'username@server.domain',
pass: 'password',
}
logger: false,
logging: true,
}
module.exports = { config };
For more options, check the ImapConfig
documentation.
Parameters host
, port
, auth
, user
and pass
are needed.
The logger
parameter set to false disable logging from imapflow, which IMAP mailbox is based on (verbose logging).
The logging
parameter set to true enable IMAP mailbox logging.
info
For typescript, you can import ImapConfig
interface with :
import { ImapConfig } from 'imap-mailbox';
You can finally use IMAP mailbox. We will see how in the next step.