How to Send Emails with Xedge IDE: A Step-by-Step Guide

The Xedge IDE simplifies sending emails, including those with attachments, including inline images, by offering an easy-to-use configuration dialog. While sending emails without this built-in Xedge feature is possible, leveraging the Xedge SMTP configuration provides a significant advantage: it encrypts your email settings and credentials within the "xedge.conf" file for enhanced security when used on platforms such as Xedge32.

To set this up, access the Xedge IDE, click the three dots in the upper right to reveal the menu, and select "SMTP Server" to launch the configuration dialog. The following screenshot shows the SMTP configuration dialog:

Xedge SMTP Configuration

The above screenshot also shows the activation of the optional built-in email log function, xedge.elog(), which allows for sending log messages. This function is integral to Xedge and is used, for example, to send a detailed stack trace and error message to the log if one of your Lua scripts encounters issues.

After entering all the SMTP settings and clicking the Save button, you should see a message similar to the following if your settings are correct.

 Xedge: Sending test email to
 Xedge: SMTP settings OK

SMTP Settings

You can use any email provider. The following settings work with Hotmail, Outlook, and Gmail.

SMTP Settings for Hotmail and Outlook

For the integration of Hotmail and Outlook accounts with Xedge, the SMTP server settings are defined as follows:

  • SMTP Server:
  • SMTP Username: Your complete Outlook email address
  • SMTP Password: Your Outlook account password
  • SMTP Port: 587
  • Connection Security: STARTTLS

SMTP Settings for Gmail

Users opting to connect their Gmail account with Xedge should utilize the following SMTP settings:

  • SMTP Server:
  • SMTP Username: Your full Gmail address
  • SMTP Password: Your Gmail App Password (Details below)
  • SMTP Port: 465
  • Connection Security: TLS

Generation of an App Password for Gmail

Gmail users cannot use their regular account password within the SMTP settings. Instead, an App Password must be generated, providing a secure method for third-party applications like Xedge to access your Gmail account. This process is only applicable for accounts with 2-step verification enabled.

  1. Access your Google Account and navigate to the 'Security' section.
  2. Within 'Signing in to Google,' select '2-Step Verification' and proceed with the setup if not already activated.
  3. Post activation, return to the 'Security' page and select 'App Passwords.'
  4. In the 'Select app' dropdown, choose 'Mail,' for 'Select device,' pick 'Other,' labeling it as 'Xedge.'
  5. Upon clicking 'Generate,' a 16-digit App Password will be provided.

This generated App Password will serve as the authentication method for Xedge to send emails through your Gmail account.

Testing the Email Functions

Now that you have configured the email settings, let's go ahead and try sending a few emails. Click the three dots in the upper right to reveal the menu. Select "Lua Shell" to launch the REPL. Copy and paste the following into the REPL, but change the "to" address.

local op={
   body="What's up?"
xedge.sendmail(op, function(ok,err) trace(ok,err) end)

Example 1: send a simple text message

See the xedge.sendmail() documentation for details on how to use this function.

local image=[[
<svg xmlns="" width="400" height="400">
  <circle cx="100" cy="100" r="50" stroke="black" stroke-width="5" fill="red"/>

local op={
   subject="A Circle",
            <img src="cid:the-unique-id" alt="circle">

xedge.sendmail(op, function(ok,err) trace(ok,err) end)

Example 2: send an HTML email with an inlined image.

Xedge Documentation Links

Send Log Messages Via Emails

Now that you have successfully configured your SMTP settings, the subsequent phase involves learning to log messages via email. For a step-by-step guide, check out the tutorial: Logging for Testing and Production Mode: Maximizing Efficiency with Xedge.

Looking for Guidance?

Don't let networking, security, and device management hold you back! Let Real Time Logic help your business, development team, or customers save time and money by handling these complex tasks for you.

With a wealth of experience creating IoT solutions and embedded device interfaces, we're well-equipped to dramatically improve your products and how you build them. And if you prefer to tackle things on your own, check out our extensive list of embedded web server and IoT tutorials.

Whether you choose to work with us or take the DIY route, we're here to help you succeed. Let's team up and make your vision a reality!


OPC-UA Client & Server

An easy to use OPC UA stack that enables bridging of OPC-UA enabled industrial products with cloud services, IT, and HTML5 user interfaces.

Edge Controller

Edge Controller

Use our user programmable Edge-Controller as a tool to accelerate development of the next generation industrial edge products and to facilitate rapid IoT and IIoT development.

On-Premises IoT

On-Premises IoT Platform

Learn how to use the Barracuda App Server as your On-Premises IoT Foundation.

Embedded Web Server

Barracuda Embedded Web Server

The compact Web Server C library is included in the Barracuda App Server protocol suite but can also be used standalone.

WebSocket Server

Microcontroller Friendly

The tiny Minnow Server enables modern web server user interfaces to be used as the graphical front end for tiny microcontrollers. Make sure to check out the reference design and the Minnow Server design guide.

WebDAV Server

Network File System

Why use FTP when you can use your device as a secure network drive.

HTTP Client

Secure HTTP Client Library

PikeHTTP is a compact and secure HTTP client C library that greatly simplifies the design of HTTP/REST style apps in C or C++.

WebSocket Client

Microcontroller Friendly

The embedded WebSocket C library lets developers design tiny and secure IoT applications based on the WebSocket protocol.

SMTP Client

Secure Embedded SMTP Library

Send alarms and other notifications from any microcontroller powered product.

Crypto Library

RayCrypto C Library

The RayCrypto engine is an extremely small and fast embedded crypto library designed specifically for embedded resource-constrained devices.

Embedded PKI Service

Automatic SSL Certificate Management for Devices

Real Time Logic's SharkTrust™ service is an automatic Public Key Infrastructure (PKI) solution for products containing an Embedded Web Server.


Modbus TCP client

The Modbus client enables bridging of Modbus enabled industrial products with modern IoT devices and HTML5 powered HMIs.

Posted in Whitepapers