Thought Leadership

Using an SMTP client

I always find it satisfying to see simple solutions to apparently complex problems and the world of embedded software certainly lends itself to some creativity. My concept of “simple” is quite broad, but essentially encompasses anything that is easy to understand [for me] and ideally avoids reinvention of any wheels.

A while ago, I wrote about incorporating a Web server [HTTP server actually] into an embedded device so that information might be displayed on any connected Web browser. Along the same lines, I have been thinking about using email …

When I talked about adding a Web server to an embedded device, I was not suggesting that the device in question actually hosted a publicly accessible website. The idea was to simply leverage Web technology. Web pages – HTML etc. – is easy enough to use to create a user interface; the HTTP protocol is straightforward to handle; Web server software is readily available for most real time operating systems, including Nucleus, of course. The result is a powerful and readily maintainable UI solution with minimal coding.

We can apply the same philosophy to the use of email. I am not, of course, suggesting that a device have an email account so that it can keep in touch with its friends and relations. I am talking about the leveraging of technology. Imagine a device that needs to periodically send [and/or perhaps receive] modest amounts of data to a remote location and it is connected [at least some of the time] to the Internet. A possible example might be a WiFi enabled vital signs monitor worn at all times by a chronically ill patient; it might send a set or readings to the hospital periodically or when there is a significant change.

Although there are a number email protocols in use, Simple Mail Transfer Protocol [SMTP] is very common and widely understood, as it has been in use since the earliest days of the Internet. SMTP is normally only used for sending emails – the sender needs to have SMTP client software and the mailer server will have an SMTP server. Other email protocols in use include Post Office Protocol [POP3], which is complementary to SMTP and used to receive email, and the Internet Message Access Protocol [IMAP], which provides more sophisticated capabilities.

SMTP is a simple, text based protocol, which really only uses 3 types of message [MAIL, RCPT and DATA]. It is, therefore, easy to apply and monitor/debug. An SMTP client can be [and usually is] very light weight and readily available for many popular RTOSes, like Nucleus. The simplicity is attractive because it minimizes development time. The small size is useful for many embedded devices where memory is at a premium, but is also a benefit for applications [like medical devices] where certification is required – less code = cheaper certification.

Colin Walls

I have over thirty years experience in the electronics industry, largely dedicated to embedded software. A frequent presenter at conferences and seminars and author of numerous technical articles and two books on embedded software, I am a member of the marketing team of the Mentor Graphics Embedded Systems Division, and am based in the UK. Away from work, I have a wide range of interests including photography and trying to point my two daughters in the right direction in life. Learn more about Colin, including his go-to karaoke song and the best parts of being British: http://go.mentor.com/3_acv

More from this author

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.sw.siemens.com/embedded-software/2013/05/28/using-an-smtp-client/