Importing Email Attachments with gsqlcmd

Importing Email Attachments with gsqlcmd

The gsqlcmd utility includes the GetAttachments feature, which allows you to save email attachments to a local folder. After saving, you can import data from these attachments using gsqlcmd.

gsqlcmd supports data extraction from various formats, including XML, JSON, CSV, HTML, Excel, and plain text files. It also automatically extracts files from ZIP and GZIP archives.

To view the short help for GetAttachments, run:

GetAttachments.exe help

To set up the tool, execute:

GetAttachments.exe init

This command creates a default configuration file named GetAttachments.cfg:

Active;Protocol;Server;Login;Password;Port;UseSSL;Delete;Mask;AttachmentFolder;ArchiveFolder
false;pop3;mail.domain.com;user@domain.com;password;995;true;false;*.gz,*.xls*;attachments;archive
false;imap;imap.domain.com;user@domain.com;password;993;true;false;*.gz,*.xls*;attachments;archive

To run the tool, use the following command:

GetAttachments.exe [<configuration file>]

Configuration File Format

The GetAttachments.cfg file is a CSV format with the following required fields:

FieldDescription
Activetrue | false
ProtocolPOP3 | IMAP
ServerPOP3 or IMAP server address
LoginUser login
PasswordUser password
PortPort number
UseSSLtrue | false
Deletetrue | false
MaskFile mask for saving attachments (e.g., *.gz, *.xls*)
AttachmentFolderFolder to save attachments
ArchiveFolderFolder for processed attachments

You can move processed attachments from the AttachmentFolder to the ArchiveFolder. The tool checks the ArchiveFolder to avoid saving processed files back into the AttachmentFolder during subsequent cycles.

This website is using cookies. By continuing to browse, you give us your consent to our use of cookies as explained in our Cookie Policy.