MailKit V1.0 For VFP9
*IMAP Client IDLE Mode
IMAP Client IDLE Mode (IDLE) is a communication protocol for handling emails.
IMAP (Internet Mail Access Protocol) is a protocol for receiving and managing emails, allowing users to operate directly on a mail server without downloading messages.
MailKit provides rich functionality and an easy-to-use API, enabling developers to work with the IMAP protocol for email sending/receiving and management.
IDLE Mode is a feature in MailKit's IMAP client that allows the client to maintain a connection with the mail server while idle, enabling immediate notifications when new emails arrive.
Using IDLE Mode improves efficiency by reducing network resource consumption, processing time, and enabling real-time email updates.
*Advantages of IMAP Client IDLE Mode Instant Notifications:
1.Clients receive immediate alerts for new emails without manual server polling, enhancing user experience.
2.Resource Efficiency: Avoids frequent connection/disconnection, reducing network overhead. Data transfers occur only when new emails arrive, minimizing bandwidth and server load.
3.Real-Time Synchronization: Maintains server connection status to sync email states (read/unread/deleted) in real time.
*Use Cases for IMAP IDLE Mode Real-Time Email Alerts:
1.Applications requiring instant push notifications for new emails.Email
2.Monitoring & Automation:Monitor specific accounts for automated email processing or actions.
3.Email Client Applications:Improve user experience and performance in email clients.
1. IMessageSummary (Message Summary)
Purpose:
Represents metadata summaries of emails (e.g., UID, subject, sender, date) without body/attachment content.
Data Sources in IDLE Mode:
Events:
MailKit.OnNewMailReceiveSummary(): New email summary received.
MailKit.OnNewMailArrives(): Number of new emails received.
MailKit.OnMailDeleted(): Email deleted.
MailKit.OnMailFlagsChanged(): Email flags updated.
Batch retrieval from the server (e.g., for email lists) to avoid downloading full content.
Use Cases:
Displaying email lists (e.g., inbox with subject/sender/time).
Filtering/sorting emails without loading full content.
Checking email statuses (e.g., read/unread).
2. MimeMessage (Full Email)
Purpose:
Represents complete email content (headers, body, attachments) parsed from raw MIME-formatted data.
Data Sources:
Events:
MailKit.OnPOP3ReceiveEmails()
MailKit.OnReceiveEmails()
Full email data downloaded from the server and parsed into structured objects.
Key Header Properties:
Property Type Description
From string Sender address list (usually a single address).
To string Primary recipient list.
Cc string Cc (Carbon Copy) list.
Bcc string Bcc (Blind Carbon Copy) list.
ReplyTo string Reply-to address (defaults to From).
Sender string Actual sender (if different from From).
Subject string Email subject (auto-encoded for special characters).
Date string Email send time (auto-generated by default).
MessageId string Unique email identifier (auto-generated).
AttachmentFileNameList string List of attachment filenames.
Database Schema Diagram
Emails
├─ EmailId (PK)
└─ UniqueId, Subject, FromAddress...
│
├─ Recipients
│ ├─ RecipientId (PK)
│ └─ EmailId (FK), Type, Address...
│
└─ Attachments
├─ AttachmentId (PK)
└─ EmailId (FK), FileName...
Core MSSQL Table Design
(1) Main Table: Emails (Email Metadata)
Column Data Type Description Maps to IMessageSummary Property
EmailId UNIQUEIDENTIFIER/BIGINT Primary key (auto-increment or GUID). -
UniqueId BIGINT IMAP UID. IMessageSummary.UniqueId.Id
Subject NVARCHAR(255) Email subject. IMessageSummary.Subject
FromAddress NVARCHAR(255) Sender’s email address. IMessageSummary.Sender
FromName NVARCHAR(255) Sender’s display name. IMessageSummary.Sender
Date DATETIME2 Send date (UTC). IMessageSummary.Date
Size INT Email size in bytes. IMessageSummary.Size
IsRead BIT Read status. IMessageSummary.MessageFlags
IsFlagged BIT Starred/flagged status. IMessageSummary.MessageFlags
(2) Relationship Table: Recipients
Column Data Type Description
RecipientId BIGINT Primary key (auto-increment).
EmailId BIGINT Foreign key (references Emails).
Type NVARCHAR(10) Recipient type (To/Cc/Bcc).
Address NVARCHAR(255) Recipient email address.
Name NVARCHAR(255) Recipient display name.
(3) Relationship Table: Attachments
Column Data Type Description
AttachmentId BIGINT Primary key (auto-increment).
EmailId BIGINT Foreign key (references Emails).
FileName NVARCHAR(255) Attachment filename.
ContentType NVARCHAR(100) MIME type (e.g., application/pdf).
Size INT Attachment size in bytes.

*IMAP Client IDLE Mode
IMAP Client IDLE Mode (IDLE) is a communication protocol for handling emails.
IMAP (Internet Mail Access Protocol) is a protocol for receiving and managing emails, allowing users to operate directly on a mail server without downloading messages.
MailKit provides rich functionality and an easy-to-use API, enabling developers to work with the IMAP protocol for email sending/receiving and management.
IDLE Mode is a feature in MailKit's IMAP client that allows the client to maintain a connection with the mail server while idle, enabling immediate notifications when new emails arrive.
Using IDLE Mode improves efficiency by reducing network resource consumption, processing time, and enabling real-time email updates.
*Advantages of IMAP Client IDLE Mode Instant Notifications:
1.Clients receive immediate alerts for new emails without manual server polling, enhancing user experience.
2.Resource Efficiency: Avoids frequent connection/disconnection, reducing network overhead. Data transfers occur only when new emails arrive, minimizing bandwidth and server load.
3.Real-Time Synchronization: Maintains server connection status to sync email states (read/unread/deleted) in real time.
*Use Cases for IMAP IDLE Mode Real-Time Email Alerts:
1.Applications requiring instant push notifications for new emails.Email
2.Monitoring & Automation:Monitor specific accounts for automated email processing or actions.
3.Email Client Applications:Improve user experience and performance in email clients.
1. IMessageSummary (Message Summary)
Purpose:
Represents metadata summaries of emails (e.g., UID, subject, sender, date) without body/attachment content.
Data Sources in IDLE Mode:
Events:
MailKit.OnNewMailReceiveSummary(): New email summary received.
MailKit.OnNewMailArrives(): Number of new emails received.
MailKit.OnMailDeleted(): Email deleted.
MailKit.OnMailFlagsChanged(): Email flags updated.
Batch retrieval from the server (e.g., for email lists) to avoid downloading full content.
Use Cases:
Displaying email lists (e.g., inbox with subject/sender/time).
Filtering/sorting emails without loading full content.
Checking email statuses (e.g., read/unread).
2. MimeMessage (Full Email)
Purpose:
Represents complete email content (headers, body, attachments) parsed from raw MIME-formatted data.
Data Sources:
Events:
MailKit.OnPOP3ReceiveEmails()
MailKit.OnReceiveEmails()
Full email data downloaded from the server and parsed into structured objects.
Key Header Properties:
Property Type Description
From string Sender address list (usually a single address).
To string Primary recipient list.
Cc string Cc (Carbon Copy) list.
Bcc string Bcc (Blind Carbon Copy) list.
ReplyTo string Reply-to address (defaults to From).
Sender string Actual sender (if different from From).
Subject string Email subject (auto-encoded for special characters).
Date string Email send time (auto-generated by default).
MessageId string Unique email identifier (auto-generated).
AttachmentFileNameList string List of attachment filenames.
Database Schema Diagram
Emails
├─ EmailId (PK)
└─ UniqueId, Subject, FromAddress...
│
├─ Recipients
│ ├─ RecipientId (PK)
│ └─ EmailId (FK), Type, Address...
│
└─ Attachments
├─ AttachmentId (PK)
└─ EmailId (FK), FileName...
Core MSSQL Table Design
(1) Main Table: Emails (Email Metadata)
Column Data Type Description Maps to IMessageSummary Property
EmailId UNIQUEIDENTIFIER/BIGINT Primary key (auto-increment or GUID). -
UniqueId BIGINT IMAP UID. IMessageSummary.UniqueId.Id
Subject NVARCHAR(255) Email subject. IMessageSummary.Subject
FromAddress NVARCHAR(255) Sender’s email address. IMessageSummary.Sender
FromName NVARCHAR(255) Sender’s display name. IMessageSummary.Sender
Date DATETIME2 Send date (UTC). IMessageSummary.Date
Size INT Email size in bytes. IMessageSummary.Size
IsRead BIT Read status. IMessageSummary.MessageFlags
IsFlagged BIT Starred/flagged status. IMessageSummary.MessageFlags
(2) Relationship Table: Recipients
Column Data Type Description
RecipientId BIGINT Primary key (auto-increment).
EmailId BIGINT Foreign key (references Emails).
Type NVARCHAR(10) Recipient type (To/Cc/Bcc).
Address NVARCHAR(255) Recipient email address.
Name NVARCHAR(255) Recipient display name.
(3) Relationship Table: Attachments
Column Data Type Description
AttachmentId BIGINT Primary key (auto-increment).
EmailId BIGINT Foreign key (references Emails).
FileName NVARCHAR(255) Attachment filename.
ContentType NVARCHAR(100) MIME type (e.g., application/pdf).
Size INT Attachment size in bytes.
