SSL POP3 Mail Example
Overview
This NetBurner embedded application demonstrates how to retrieve email from a server that requires SSL/TLS using the POP3 protocol. The application provides a web interface for configuring mail server settings and retrieving messages, which are then saved to external flash storage.
- Note
- When connecting to a Google Account, you will likely need to enable less secure application access. If you use two-factor authentication with your account, you will need to setup an application password for the account being connected to. This can be done at the following URL: https://myaccount.google.com/apppasswords. The application password is not saved and will need to be reentered for every request.
Key Features
- SSL/TLS POP3 Email Retrieval: Secure connection to POP3 mail servers
- Web-based Configuration Interface: HTML forms for setting up mail server credentials
- File System Integration: Saves retrieved emails to SD/MMC/SDHC cards or Compact Flash
- FTP Server: Built-in FTP server for file management
- HTTPS Web Server: Secure web interface on port 443
- Multiple Storage Support: Compatible with various flash storage types
Application Components
Main Application (main.cpp)
The main application initializes:
- Network stack with DHCP support
- File system for multiple task priorities
- External flash storage (SD/MMC/SDHC/CFC)
- HTTPS web server on port 443
- FTP server on port 21
File System Utilities
- FileSystemUtils.cpp/h: Comprehensive file system operations including mount/unmount, format, read/write operations, and directory management
- cardtype.h: Hardware abstraction for different storage types (SD/MMC, SDHC, CFC, RAM)
Network Services
- FTP Server (ftp_f.cpp/h): Full FTP implementation with file transfer, directory operations, and multi-drive support
- Web Interface (webfuncs.cpp): HTTP POST/GET handlers for email configuration and retrieval
Time Management
- effs_time.cpp/h: Time synchronization using NTP servers, manual time setting, and RTC integration for file timestamps
Web Interface
The application provides an HTML-based interface accessible via HTTPS:
Main Page (index.html)
- Network configuration display (IP, gateway, DNS)
- POP3 server settings form:
- Mail username and password
- POP3 server hostname/IP
- Port number (default 995 for SSL)
- Number of messages to retrieve
Results Page (sent.html)
- Displays retrieval status
- Provides links to downloaded email files
- Shows error details if retrieval fails
Storage Configuration
The application supports multiple storage types configured in cardtype.h:
- SDHC: SD/SDHC cards (default for SB800EX and SOMRT1061 platforms)
- MMC: SD/MMC cards
- CFC: Compact Flash cards
- RAM: RAM-based file system for testing
Gmail Integration Notes
When connecting to Gmail accounts:
- Enable "Less secure app access" or use App Passwords for 2FA accounts
- Configure App Password at: https://myaccount.google.com/apppasswords
- Use server: pop.gmail.com, port: 995
- The App Password must be re-entered for each session (not stored)
File Operations
Retrieved emails are automatically:
- Converted to HTML format for web viewing
- Saved with sequential filenames (email1.html, email2.html, etc.)
- Accessible via web browser or FTP client
- Timestamped using system time
Error Handling
The application includes comprehensive error handling for:
- Network connectivity issues
- DNS resolution failures
- SSL/TLS connection problems
- File system errors
- Storage device detection and write protection
Build Requirements
- NetBurner development environment
- SSL/TLS library support
- EFFS (Embedded Flash File System) libraries
- Network stack with DHCP and DNS support
Usage Instructions
- Connect and power the NetBurner device
- Ensure SD card or other storage is inserted
- Access the web interface via HTTPS
- Configure network settings if using static IP
- Enter POP3 server credentials
- Click "Get Mail" to retrieve messages
- Access downloaded emails via provided links or FTP