View Categories

Email Integration & Connectivity

5 min read

Gmail Integration #

OAuth Connection and Setup #

Corcava provides seamless Gmail integration through Google OAuth authentication:

Gmail Connection Process:

1. OAuth Authorization: Initiate connection through Google OAuth flow 2. Permission Grant: Grant necessary permissions for email access and sending 3. Token Management: Secure storage of access and refresh tokens 4. Account Verification: Verify email account ownership and validity 5. Integration Confirmation: Receive confirmation of successful Gmail connection

OAuth Configuration:

  • Access Type: Offline access for continuous email functionality
  • Account Selection: Prompt for account selection during authentication
  • Consent Flow: Full consent flow ensuring proper permission grants
  • State Management: Secure state parameter handling for callback validation
  • Required Permissions:

  • Gmail Compose: Permission to compose and create email messages
  • Gmail Send: Permission to send emails through connected Gmail account
  • Gmail Read Only: Permission to read incoming emails for synchronization
  • Calendar Events: Permission to manage calendar events (for meeting integration)
  • Calendar Read Only: Permission to read calendar information
  • Gmail API Functionality #

    Gmail integration leverages Google’s Gmail API for comprehensive email management:

    Email Sending Capabilities:

  • Message Creation: Create properly formatted Gmail messages with HTML content
  • Subject Encoding: UTF-8 base64 encoding for international subject lines
  • MIME Formatting: Proper MIME-Version and Content-Type headers for email compatibility
  • Message Transmission: Send emails through Gmail API with proper authentication
  • Message Formatting:

  • HTML Content Support: Full HTML email content with rich formatting
  • Character Encoding: UTF-8 encoding for international character support
  • Email Headers: Proper From, To, Subject, and MIME headers
  • Content Transfer Encoding: Quoted-printable encoding for reliable delivery
  • Token Management:

  • Access Token Validation: Automatic validation of access token expiry
  • Refresh Token Handling: Automatic token refresh when access tokens expire
  • Token Updates: Seamless token updates without user intervention
  • Error Handling: Comprehensive error handling for expired or invalid tokens
  • Gmail Account Management #

    Gmail accounts are managed efficiently within team structures:

    Account Organization:

  • Team-Based Management: Gmail accounts are organized by team for proper access control
  • User Association: Each Gmail account is associated with a specific user
  • Multiple Account Support: Users can connect multiple Gmail accounts
  • Provider Identification: Clear identification of Google as the email provider
  • Account Storage:

  • Secure Token Storage: Access and refresh tokens stored securely
  • Email Address Recording: Connected Gmail addresses stored for identification
  • Account Status Tracking: Monitor account connection status and validity
  • Error State Management: Track and manage token expiration and error states
  • Microsoft/Outlook Integration #

    Microsoft Graph API Connection #

    Corcava supports Microsoft 365 and Outlook integration through Microsoft Graph API:

    Microsoft Connection Process:

    1. OAuth Redirect: Redirect to Microsoft OAuth authorization endpoint 2. Scope Authorization: Request necessary permissions for email and calendar access 3. Account Selection: Prompt for Microsoft account selection 4. Token Exchange: Exchange authorization code for access and refresh tokens 5. Account Creation: Create UserMailbox record with Microsoft credentials

    Microsoft OAuth Configuration:

  • Provider Selection: Microsoft provider identification and configuration
  • Account Prompt: Select account prompt for multi-account scenarios
  • Response Type: Authorization code flow for secure token exchange
  • Offline Access: Offline access for continuous functionality
  • Required Microsoft Scopes:

  • Offline Access: Permission for offline token refresh capabilities
  • User.Read: Permission to read basic user profile information
  • Mail.Read: Permission to read emails from connected Microsoft account
  • Mail.Send: Permission to send emails through Microsoft Graph API
  • Calendars.ReadWrite: Permission to manage calendar events and meetings
  • Microsoft Account Management #

    Microsoft accounts are integrated seamlessly with the platform:

    Account Integration:

  • Stateless Authentication: Stateless OAuth flow for secure authentication
  • User Information Extraction: Extract email and user information from Microsoft response
  • Account Storage: Store access tokens, refresh tokens, and email addresses
  • Team Association: Associate Microsoft accounts with appropriate teams and users
  • Microsoft Provider Support:

  • Provider Identification: Clear identification of Microsoft as email provider
  • Account Display: Proper display names and identification for Microsoft accounts
  • Token Management: Secure storage and management of Microsoft authentication tokens
  • Error Handling: Comprehensive error logging and handling for Microsoft authentication
  • Email Account Management #

    Managing Multiple Connected Accounts #

    Corcava supports multiple email account connections per user and team:

    Multi-Account Support:

  • Provider Diversity: Support for both Google and Microsoft email providers
  • Team Organization: Email accounts organized by team with proper access control
  • User Assignment: Each email account associated with specific users
  • Account Identification: Clear identification of account providers and email addresses
  • Account Management Features:

  • Account Creation: Easy creation of new email account connections
  • Account Updates: Update existing account credentials and tokens
  • Account Refresh: Refresh expired tokens for continued functionality
  • Account Display: User-friendly display of connected email accounts
  • Provider Management:

  • Google Integration: Full Google/Gmail account management capabilities
  • Microsoft Integration: Complete Microsoft/Outlook account management
  • Provider Selection: Easy selection between supported email providers
  • Unified Interface: Consistent interface regardless of email provider
  • Email Account Storage and Security #

    Email accounts are stored securely with comprehensive security measures:

    Secure Storage:

  • Token Encryption: Secure storage of access and refresh tokens
  • Team Isolation: Email accounts isolated by team for security
  • User Association: Accounts properly associated with authorized users
  • Provider Tracking: Clear tracking of email provider for each account
  • Account Validation:

  • Token Validation: Regular validation of stored authentication tokens
  • Expiry Management: Automatic handling of token expiration
  • Error State Tracking: Track and manage account error states
  • Connection Status: Monitor connection status for all email accounts
  • Email Sending #

    Sending Through Connected Accounts #

    Connected email accounts enable direct email sending through external providers:

    Gmail Sending:

  • API Integration: Send emails directly through Gmail API
  • Authentication: Use stored access tokens for authenticated sending
  • Message Formatting: Proper message formatting for Gmail compatibility
  • Delivery Confirmation: Receive confirmation of successful email delivery
  • Sending Process:

  • Account Selection: Select from available connected email accounts
  • Message Preparation: Prepare messages with proper formatting and headers
  • Authentication: Authenticate using stored account credentials
  • Delivery Tracking: Track email sending status and results
  • Email Composition:

  • HTML Content: Support for rich HTML email content
  • Subject Handling: Proper subject line encoding and formatting
  • Recipient Management: Handle single and multiple recipients
  • Error Handling: Comprehensive error handling for sending failures
  • Outgoing Email Management #

    Outgoing emails are tracked and managed comprehensively:

    Email Status Tracking:

  • Status States: Track email status (sent, failed, queued, draft)
  • Delivery Confirmation: Record successful email delivery
  • Error Logging: Log and track email sending errors
  • Status Updates: Real-time status updates for outgoing emails
  • Outgoing Email Features:

  • UserMailbox Association: Link outgoing emails to specific connected accounts
  • Recipient Tracking: Track email recipients and delivery addresses
  • Subject Recording: Record email subjects for reference and tracking
  • Content Management: Manage email content and formatting
  • Email Synchronization #

    Incoming Email Processing #

    Corcava automatically processes incoming emails from connected accounts:

    Automatic Email Retrieval:

  • Scheduled Processing: Regular retrieval of incoming emails from connected accounts
  • Contact Matching: Match incoming emails to existing contacts in the system
  • Duplicate Prevention: Prevent duplicate email processing and storage
  • Message Extraction: Extract email subject, content, and metadata
  • Email Processing Workflow:

    1. Account Scanning: Scan connected Gmail accounts for new messages 2. Contact Identification: Identify emails from known contacts 3. Duplicate Check: Check for existing emails to prevent duplicates 4. Activity Creation: Create contact activity records for new emails 5. Email Storage: Store incoming email details and content

    Contact Activity Integration #

    Incoming emails are integrated with contact activity tracking:

    Activity Recording:

  • Contact Association: Associate incoming emails with specific contacts
  • Activity Type: Record emails as contact activities with proper typing
  • Timeline Integration: Include emails in contact activity timeline
  • User Attribution: Associate email activities with appropriate users
  • Email Activity Features:

  • Subject Tracking: Record email subjects for activity reference
  • Message Content: Store email message content for review
  • Contact Linking: Direct links between emails and contact records
  • Activity History: Complete history of email communications per contact
  • Synchronization Benefits:

  • Unified Communication: All email communications centralized in contact records
  • Activity Timeline: Chronological timeline of all contact interactions
  • Team Visibility: Team-wide visibility into email communications
  • Contact Context: Full context of email communications for each contact