Email Integration Overview
Email integration enables:- Automatic Ticket Creation: Incoming emails create tickets automatically
- Email Threading: Replies maintain conversation context
- Outbound Email: Send responses from your support email address
- Multiple Accounts: Support multiple email addresses for different teams
- Service Provider Support: Pre-configured for Gmail, Outlook, Yahoo, and more
Supported Email Services
Frappe Helpdesk includes pre-configured settings for popular email providers (seehelpdesk/api/settings/email.py:74-148):
- Gmail: Google Workspace and personal Gmail accounts
- Outlook: Microsoft 365 and Outlook.com
- Yahoo Mail: Yahoo email accounts
- Yandex Mail: Yandex email service
- Frappe Mail: Native integration with Frappe Mail
- SendGrid: Transactional email service
- SparkPost: Email delivery platform
- Custom IMAP/SMTP: Any email provider with IMAP/SMTP access
Prerequisites
Before setting up email integration:Prepare Email Account
- Create a dedicated email address for support (e.g., [email protected])
- Don’t use personal email addresses
- Ensure account has IMAP and SMTP access enabled
Enable IMAP/SMTP
For most providers:
- Enable IMAP in email settings
- Enable “less secure apps” or app-specific passwords
- Note down IMAP and SMTP server addresses
Adding an Email Account
Choose Email Service
Select your email provider from the list:
- Gmail
- Outlook
- Yahoo
- Frappe Mail
- Custom (for other providers)
Enter Basic Information
Fill in the required fields:
- Email Account Name: Descriptive name (e.g., “Support Email”)
- Email ID: Your email address (e.g., [email protected])
- Password: Email password or app-specific password
Configure Incoming Email
Set incoming email options:
- Enable Incoming: Check to receive emails
- Default Incoming: Make this the default for receiving emails
- Email Sync Option: Choose “ALL” to sync all emails
- Initial Sync Count: Number of recent emails to sync (default: 100)
Configure Outgoing Email
Set outgoing email options:
- Enable Outgoing: Check to send emails
- Default Outgoing: Make this the default for sending emails
- Track Email Status: Enable delivery tracking
Service-Specific Configuration
Gmail
Generate App Password
- Go to Google Account > Security
- Enable 2-Step Verification
- Go to App Passwords
- Generate password for “Mail” application
- Copy the 16-character password
Configure in Helpdesk
- Service: Gmail
- Email ID: [email protected]
- Password: Paste the app password
- Use SSL: Enabled (automatic)
- Email Server: imap.gmail.com (automatic)
- SMTP Server: smtp.gmail.com (automatic)
email.py:95-99):
Outlook / Microsoft 365
Use App Password (if 2FA enabled)
- Go to Microsoft Account Security
- Create app password
- Use for Helpdesk configuration
Configure in Helpdesk
- Service: Outlook
- Email ID: [email protected] or [email protected]
- Password: Account password or app password
- Use SSL: Enabled (automatic)
- Email Server: imap-mail.outlook.com (automatic)
- SMTP Server: smtp-mail.outlook.com (automatic)
Yahoo Mail
Generate App Password
- Go to Yahoo Account Security
- Turn on 2-Step Verification
- Generate app password for “Mail”
- Copy the password
Configure in Helpdesk
- Service: Yahoo
- Email ID: [email protected]
- Password: App password
- Use SSL: Enabled (automatic)
- Email Server: imap.mail.yahoo.com (automatic)
- SMTP Server: smtp.mail.yahoo.com (automatic)
- SMTP Port: 587 (automatic)
Frappe Mail
Frappe Mail provides native integration with special features:Configure in Helpdesk
- Service: Frappe Mail
- Email ID: [email protected]
- Frappe Mail Site: Your Frappe Mail site URL
- API Key: From Frappe Mail
- API Secret: From Frappe Mail
- Append To: HD Ticket (automatic)
email.py:37-41):
Custom IMAP/SMTP
For providers not listed:Gather Server Information
Get from your email provider:
- IMAP server address and port
- SMTP server address and port
- SSL/TLS requirements
Configure in Helpdesk
- Service: Custom
- Email ID: [email protected]
- Password: Email password
- Email Server: IMAP server (e.g., mail.yourhost.com)
- Incoming Port: Usually 993 (SSL) or 143 (STARTTLS)
- SMTP Server: SMTP server
- SMTP Port: Usually 465 (SSL) or 587 (TLS)
- Use SSL: Enable if required
- Use STARTTLS: Enable if required
- Use TLS: Enable if required
Email Sync Configuration
Sync Options
Control which emails are synced:- ALL: Sync all emails (read and unread)
- UNSEEN: Only sync unread emails
Initial Sync Count
Defines how many recent emails to sync on first connection:- Default: 100 emails
- Increase for accounts with high volume
- Lower for testing or new accounts
email.py:27-28:
IMAP Folder Configuration
Specify which folders to monitor:Add IMAP Folders
For non-Frappe Mail services, configure folders:
- Folder Name: Usually “INBOX”
- Append To: HD Ticket
email.py:60-62
Auto-Generated Email Filtering
The system automatically ignores auto-generated emails to prevent loops:- Out-of-office replies from creating tickets
- Email feedback notifications from creating loops
- System-generated emails from becoming tickets
Ticket Creation from Email
How It Works
Ticket is Created
System creates a new HD Ticket:
- Subject: Email subject line
- Description: Email body (HTML preserved)
- Raised By: Sender email address
- Contact: Auto-created or linked if exists
- Attachments: Email attachments are linked
Contact and Customer Linking
System automatically:
- Creates Contact if it doesn’t exist
- Links to Customer if Contact is associated
- Sets
create_contact: 1in email account config
Email Threading
Replies to tickets maintain conversation context:- In-Reply-To Header: Links reply to original ticket
- References Header: Maintains email thread
- Subject Prefix: “Re:” indicates reply
- System identifies existing ticket by message-id
- Adds reply as Communication on the ticket
- Updates last_customer_response timestamp
- Reopens ticket if status was resolved
Sending Email from Tickets
Composing Responses
Write Response
Use the email editor:
- Compose your message
- Use saved replies for common responses
- Attach files if needed
- Format with rich text editor
Email Account Selection
Outbound emails are sent from:- Default Outgoing Account: Marked as default
- Ticket’s Email Account: If ticket came via specific email
- System Default: Fallback if no default is set
Email Customization
Customize email content in HD Settings:Acknowledgement Email
Sent when ticket is created via email:- Enable: Settings > Email Customizations > Send Acknowledgement Email
- Content: Customize the acknowledgement_email_content field
- Template Variables: Use
{{ doc.subject }},{{ doc.name }}, etc.
Feedback Email
Sent when ticket is resolved:- Enable: Settings > Email Customizations > Enable Email Ticket Feedback
- Status Trigger: Send on specific status or “Closed”
- Content: Customize feedback_email_content field
- Feedback Link: Automatically includes feedback URL
hd_settings.json:68-74
Reply Notification
Notify customers when agents reply:- Enable Reply Email to Agent: Notify agent when customer replies
- Enable Reply Email via Agent: Notify customer when agent replies
- Customize Content: Tailor notification messages
Advanced Configuration
SSL/TLS Settings
Control encryption:- Use SSL: SSL encryption for IMAP (port 993)
- Use TLS: TLS encryption for SMTP (port 587)
- Use STARTTLS: STARTTLS for IMAP
- Use SSL for Outgoing: SSL for SMTP (port 465)
Certificate Validation
- Validate SSL Certificate: Verify IMAP server certificate
- Validate SSL Certificate for Outgoing: Verify SMTP server certificate
Authentication
- Login ID: Use different login ID than email address
- No SMTP Authentication: Disable for servers that don’t require it
- ASCII Encode Password: Enable for special characters
Email Headers
Custom email headers are automatically added:Troubleshooting
Email Account Not Syncing
Issue: Emails aren’t creating tickets Solutions:- Check email account is enabled
- Verify IMAP credentials are correct
- Check IMAP folder name is correct
- Review error log for connection errors
- Test with a manual sync
- Verify firewall allows IMAP connections
Authentication Errors
Issue: “Authentication failed” errors Solutions:- Verify password is correct
- Use app-specific password if 2FA is enabled
- Enable “less secure apps” (if applicable)
- Check if account is locked
- Verify email address format
SSL/TLS Errors
Issue: SSL certificate validation errors Solutions:- Enable “Use SSL” for SSL connections
- Use correct port (993 for SSL, 143 for STARTTLS)
- Disable certificate validation for self-signed certs
- Update server time if clock skew error
- Check firewall allows SSL connections
Outgoing Email Not Sending
Issue: Responses don’t reach customers Solutions:- Check SMTP credentials
- Verify SMTP port (587 for TLS, 465 for SSL)
- Enable “Use TLS” or “Use SSL”
- Check email account has “Enable Outgoing” checked
- Review SMTP error logs
- Verify SPF/DKIM records for domain
Duplicate Tickets
Issue: Same email creates multiple tickets Solutions:- Check message-id tracking
- Verify email threading is working
- Review sync settings (use UNSEEN instead of ALL)
- Check for multiple email accounts monitoring same inbox
Email Not Threading
Issue: Replies create new tickets instead of updating existing Solutions:- Ensure In-Reply-To header is present
- Check email client preserves threading headers
- Verify message-id is being tracked
- Review Communication records for correct reference
Best Practices
Email Account Management
- Dedicated Addresses: Use separate email addresses for each team or department
- Clear Naming: Use descriptive account names (e.g., “Technical Support”, “Billing Team”)
- Regular Monitoring: Check email account status and sync logs
- Backup Credentials: Store credentials securely
- Test Regularly: Send test emails to verify sync is working
Security
- App Passwords: Always use app-specific passwords for 2FA accounts
- SSL/TLS: Enable encryption for all connections
- Certificate Validation: Keep enabled in production
- Password Rotation: Change passwords regularly
- Access Control: Limit who can modify email account settings
Performance
- Sync Frequency: Balance between responsiveness and server load
- Initial Sync: Start with lower count, increase if needed
- Folder Monitoring: Only monitor necessary folders
- Archive Old Emails: Clean up inbox regularly
- Error Handling: Monitor logs for sync errors
Email Content
- Professional Templates: Customize email templates to match brand
- Clear Subject Lines: Ensure subject indicates purpose
- Signature: Include contact information and support hours
- Unsubscribe: Provide opt-out for notification emails
- Mobile-Friendly: Test emails on mobile devices