NetBurner 3.5.7
PDF Version
SSL/TLS Send Mail

SSL/TLS Send Mail Example

A NetBurner embedded application that demonstrates secure email transmission using SSL/TLS protocols.

Overview

This application illustrates how to send email messages from a NetBurner device to mail servers that require SSL/TLS encryption. The implementation provides a web-based interface for configuring email settings and sending messages securely over HTTPS connections.

Key Features

  • SSL/TLS encrypted email transmission
  • Web-based configuration interface
  • Support for both direct SSL and STARTTLS negotiation methods
  • SMTP authentication support
  • Network time synchronization via NTP
  • File system utilities for external storage devices

SSL/TLS Connection Methods

The application supports two SSL/TLS handshake methods:

Direct SSL Connection

  • Connects directly to SSL/TLS ports (465 or 587)
  • Uses SSL_connect for immediate secure connection
  • Recommended for servers known to support SSL/TLS
  • Suitable for services like Yahoo that expect SSL connections on specific ports

STARTTLS Method

  • Initially connects to standard SMTP port 25
  • Performs EHLO command to check server capabilities
  • If server responds with "STARTTLS", initiates SSL negotiation
  • Required for Gmail and servers that mandate TLS encryption

Configuration Requirements

Network Setup

  • Valid IP address, network mask, gateway, and DNS configuration
  • Internet connectivity for NTP time synchronization and mail transmission
  • DHCP support available (set IP address to 0.0.0.0 to enable)

Gmail Configuration

When connecting to Gmail accounts:

  1. Enable "less secure application access" in account settings
  2. For two-factor authentication accounts, create an application-specific password
  3. Use server: smtp.gmail.com
  4. Use port: 465 or 587
  5. Leave STARTTLS unchecked
  6. Generate app passwords at: https://myaccount.google.com/apppasswords

Yahoo Configuration

  • Requires premium services (mailplus or bizmail) - free accounts not supported
  • Does not support STARTTLS detection
  • Connect to port 465/587 for SSL or port 25 for non-SSL

Application Structure

Core Components

main.cpp**

  • Application entry point and initialization
  • Network stack setup and HTTPS server startup
  • NTP time synchronization
  • System diagnostics enablement

    webfuncs.cpp**

  • Web interface implementation
  • Form handling for email configuration
  • SSL email transmission logic
  • Network and DNS management

    index.html**

  • Web-based user interface
  • Dynamic port selection based on STARTTLS setting
  • Network configuration display
  • Email form with validation

File System Support

The application includes comprehensive file system utilities supporting:

  • SD/MMC cards
  • SDHC cards
  • Compact Flash (CFC)
  • RAM drives

    Supported Operations:**

  • File creation, reading, writing, and deletion
  • Directory management
  • FTP server functionality
  • Multiple storage device types

Usage Instructions

  1. Network Configuration
    • Verify IP gateway and DNS settings
    • Enable DHCP by setting IP to 0.0.0.0 (optional)
  2. Email Configuration
    • Enter mail username and password
    • Specify SMTP server hostname
    • Set appropriate port (25, 465, or 587)
    • Configure STARTTLS if required by server
  3. Send Email
    • Fill in sender and recipient addresses
    • Enter subject and message body
    • Click "Send Mail" to transmit

Technical Implementation

Security Features

  • SSL/TLS encryption for all mail transmission
  • HTTPS web interface
  • Secure credential handling
  • DNS lookup validation

Error Handling

  • Comprehensive DNS failure detection
  • SSL connection error reporting
  • File system error codes with descriptions
  • Network timeout management

Development Requirements

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

Platform Support

  • NetBurner embedded platforms
  • Multiple storage device interfaces
  • Real-time clock integration
  • Timezone management with DST support

Error Codes and Troubleshooting

The application provides detailed error reporting for:

  • File system operations (38 defined error codes)
  • Network connectivity issues
  • SSL/TLS handshake failures
  • SMTP authentication problems
  • DNS resolution failures