Skip navigation

embOS/IP SMTP Client

  • Supports secure connections
  • Attachments supported
  • MIME type of attachments and save filename can be set
  • Source code comes with the SMTP Client.

The SEGGER SMTP client utility is a free command line program that uses the embOS/IP SMTP client API to allow you to send mails via an SMTP server from the command line.

Using SEGGER middleware to send mails from your target

It is able to connect to secure SMTP servers using emSSL and send an arbitrary mail to an arbitrary recipient. An attachment file can also be added.

While it actually provides value in real life (e.g. to send automated emails on certain events via command line), its other purpose is serve as an example application demonstrating the functionality and ease of use of the SEGGER SMTP client.

The utility uses only the official API provided by the embOS/IP SMTP client add-on and emSSL for sending a mail. The same functionality can be achieved on any resource constrained embedded target, using the same source code.

Use cases for an SMTP client

An SMTP client in your target allows you to automatically notify you in an effective way about regular notifications and/or warnings and errors. From a simple "I am still alive and this is my status" message up to a detailed report including statistics, everything is possible.

Using the SMTP client you can enable your target for the most widely accepted way of communication, using a simple and easy to handle API.

The SEGGER SMTP client utility evaluation package

A free Windows executable is available for evaluation purposes. It allows you to specify various parameters using the command line or alternate it will ask you in an interactive console for missing parameters that are mandatory.
The tool comes without any warranty and in binary form only. For a source code version, please contact us. 

Getting started with the SEGGER SMTP client utility evaluation

The SMTP client utility package consists of the following files:

  • SMTPClientUtil.exe
    The SMTP client utility itself.
  • Logo.gif
    A sample image file for testing the attachment feature.
SMTPClientUtil_Folder.png
Content of the evaluation package

The SMTP Client Utility and how to use it

Evaluating the SMTP client utility

The SMTP client utility comes with several command line arguments that allow using the utility completely without interaction of the user. For a list of arguments you can start the utility with "?", "/?" or "--help".

The utility is started including a "-to" argument, as otherwise it will take the FROM address that is entered interactive. Not using "-to"  when starting the utility can be used in case you want to send yourself a test mail. In this case you only specify FROM (as argument or interactive) and it will be used for TO as well.

The message to send is entered line by line and confirmed by pressing [ENTER]. The complete message is sent out when only a single full stop character followed by [ENTER] is given.

SMTPClientUtil_01.png
Regular mail is sent using the utility
SMTPClientUtil_02.png
A mail is prepared to be sent from our generic support address to our specific embOS/IP support address

The utility should respond "Mail sent" in case all parameters were O.K. and it was able to pass the mail to your SMTP server.

SMTPClientUtil_03_677x.png
The confirmation that this has worked as intended

Sending attachments

The SMTP client utility is also able to add one or even multiple attachments to a message. To add an attachment the argument "-attach" can be used (for multiple attachments use multiple "-attach" arguments).

The syntax for an attachment is as follows: -attach:"<MIME/type>Path\File.ext<FileName>"

SMTPClientUtil_04.png
For multiple attachments use multiple "-attach" arguments.

MIME/type

The MIME type of the attachment has to be known for the sender to be able to correctly display it. For a list of MIME types please refer to one of the many resources on the internet. One can be found here: www.sitepoint.com/web-foundations/mime-types-complete-list/

 

 

Path\File.ext

The actual file on your disk that you want to attach to the mail. In our case it is in the same folder, so we do not need the complete path. Another sample would be C:\Temp\Logo.gif .

FileName

The name of the file as it is shown when receiving the mail. Files attached to mails have no context by default. They are in fact only one of possibly many multipart items in a mail. The FileName allows the receiver to identify this item as a file. By not specifying a FileName it might happen that your mail client does not show you that an attachment is present at all or does not allow you to save it easily.

Once the mail has been sent out we can confirm that attachments are working as well by having another look at our mail client.