In this section, we present how to connect Email accounts to MindsDB.
By connecting your email account to MindsDB, you can utilize various AI models available within MindsDB to summarize emails, detect spam, or even automate email replies.
Please note that currently you can connect Gmail and Outlook accounts using this integration.
Connection
This handler was implemented using standard Python libraries: email
, imaplib
, and smtplib
.
The Email handler is initialized with the following required parameters:
email
stores an email address used for authentication.password
stores a password used for authentication.
Additionally, the following optional parameters can be passed:
smtp_server
used to send emails. Defaults tosmtp.gmail.com
.smtp_port
used to send emails. Defaults to587
.imap_server
used to receive emails. Defaults toimap.gmail.com
.
At the moment, the handler has been tested with Gmail and Outlook accounts.
To use the handler on a Gmail account, you must create an app password following this instruction and use its value for the password
parameter.
By default, the Email handler connects to Gmail. If you want to use other email providers as Outlook, add the values for imap_server
and smtp_server
parameters.
Gmail
To connect your Gmail account to MindsDB, use the below CREATE DATABASE
statement:
It creates a database that comes with the emails
table.
Outlook
To connect your Outlook account to MindsDB, use the below CREATE DATABASE
statement:
It creates a database that comes with the emails
table.
Usage
Now you can query for emails like this:
And you can apply filters like this:
Or, write emails like this: