NetBurner 3.5.6
PDF Version
SSL/TLS Send Mail w/ EFFS Attchment

SSL Send Mail with EFFS Attachment

Overview

This NetBurner application demonstrates how to send email messages with file attachments using SSL/TLS encryption and the EFFS (Embedded Flash File System) FAT32 file system. The application provides a web-based interface for configuring email settings and sending messages with attachments from SD/MMC cards or other supported storage devices.

Features

  • Secure Email Transmission: Uses SSL/TLS encryption for secure SMTP connections
  • Web-Based Interface: Complete email configuration and sending through a web page
  • File Attachments: Attach files from the EFFS FAT32 file system
  • Text Attachments: Create text file attachments directly from web form input
  • SMTP Authentication: Supports authenticated SMTP connections
  • FTP Server: Built-in FTP server for file management on the storage device
  • Multiple Storage Types: Supports SD/MMC, SDHC, Compact Flash, and RAM drives
  • Time Synchronization: NTP time synchronization with manual fallback

    NBEclipse Linker Configuration:** Add libStdFFile.a library:

  1. Right-click project, select "Properties"
  2. Navigate to "C/C++ Builds -> Settings"
  3. Select "GNU C/C++ Linker -> Libraries"
  4. Add "StdFFile" to Libraries list

Application Components

Core Modules

  • main.cpp: Main application entry point and initialization
  • webfuncs.cpp: Web interface functions for email configuration and sending
  • FileSystemUtils.cpp/h: File system utilities for EFFS operations
  • effs_time.cpp/h: Time management functions (NTP, manual, RTC)
  • ftp_f.cpp/h: FTP server implementation for file system access
  • cardtype.h: Storage device type configuration

Web Interface

  • index.html: Main configuration page for email settings
  • Web form includes fields for:
    • SMTP server settings (server, port, username, password)
    • Email details (from, to, subject, message body)
    • Attachment options (text creation, SD card file selection)

Getting Started

Hardware Requirements

  1. NetBurner development board from supported platforms
  2. SD/MMC card, SDHC card, or Compact Flash card (depending on configuration)
  3. Network connection (Ethernet)
  4. Storage device properly inserted and formatted as FAT32

Network Configuration

  1. Configure IP address, gateway, and DNS settings
  2. For DHCP, set IP address to 0.0.0.0 using IPSetup
  3. Ensure internet connectivity for NTP time synchronization

Email Server Configuration

The application uses SSL/TLS on port 465 by default. For Gmail:

  1. Server: smtp.gmail.com
  2. Port: 465
  3. Enable "Less secure app access" or use an application-specific password
  4. For two-factor authentication, generate an app password at: https://myaccount.google.com/apppasswords

Usage

  1. Power on and Initialize: The device will automatically:
    • Initialize the network stack
    • Mount the storage device
    • Synchronize time via NTP
    • Start the web and FTP servers
  2. Access Web Interface: Connect to the device's IP address via HTTPS
    • All connections must use HTTPS due to SSL configuration
  3. Configure Email Settings: Fill out the web form with:
    • SMTP server credentials
    • Email addresses and content
    • Attachment options
  4. Send Email: Click "Send Mail" to transmit the email with attachments

File Management

The application includes an FTP server for convenient file management:

  • Upload files to the storage device via FTP
  • View and organize files on the SD card
  • Prepare files for email attachment

Storage Device Support

The application supports multiple storage types through compile-time configuration:

  • SD/MMC Cards: Standard SD and MultiMedia cards
  • SDHC Cards: High-capacity SD cards
  • Compact Flash: CF cards with appropriate hardware interface
  • RAM Drive: In-memory file system for testing

Storage type is configured in cardtype.h - only one type can be used at a time.

Security Features

  • SSL/TLS Encryption: All SMTP communications are encrypted
  • HTTPS Web Interface: Secure web-based configuration
  • Authentication Support: SMTP username/password authentication
  • Application Passwords: Support for modern email provider security

Error Handling

The application includes comprehensive error handling:

  • EFFS file system error codes and descriptions
  • Network timeout and retry mechanisms
  • DNS resolution error reporting
  • Detailed error logging for troubleshooting

Time Management

Accurate timestamps are maintained through:

  1. NTP Synchronization: Primary time source from internet time servers
  2. Manual Time Setting: Fallback when NTP is unavailable
  3. RTC Support: Real-time clock integration where available
  4. Timezone Configuration: Proper timezone handling for file timestamps

File System Operations

The EFFS utilities provide:

  • File reading/writing operations
  • Directory listing and navigation
  • Space usage statistics
  • File deletion and management
  • Support for long filenames (platform dependent)

Development Notes

  • The application uses the HCC Embedded EFFS FAT32 file system
  • File system access requires proper task initialization with f_enterFS()
  • Multiple tasks can access the file system simultaneously (up to 10)
  • Storage devices must be properly formatted as FAT32
  • Write protection detection and handling included

Troubleshooting

Common Issues

  1. Storage Device Not Detected: Ensure card is properly inserted and supported
  2. Write Protection: Remove write protection from SD card
  3. Email Send Failures: Verify SMTP settings and network connectivity
  4. Time Sync Issues: Check internet connectivity for NTP
  5. File Access Errors: Ensure proper FAT32 formatting

Error Codes

The application provides detailed EFFS error codes for file system operations. Common errors include:

  • F_ERR_CARDREMOVED: Storage device was removed
  • F_ERR_WRITEPROTECT: Device is write-protected
  • F_ERR_NOTFORMATTED: Device needs formatting
  • F_ERR_NOMOREENTRY: Directory full