Forums

simple SMTP-client for embedded linux application

Started by Roman Mashak May 7, 2004
Hello, All!

    We are building embedded linux system, and we need to add some SMTP
function - smtp-client.
    Could you please recommend something very simple, that can be further
modified for adding new features etc. I guess, sendmail/postfix/qmail are
not supposed to be included in embedded environment.

    Thank you for any help!

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru


> We are building embedded linux system, and we need to add some SMTP > function - smtp-client.
Do you mean CLIENT (send mail) or SERVER (receive inbound SMTP connections)? The simplest possible client is a function of about a dozen lines of C code that opens a connection to port 25 of the target SMTP server, and sends: MAIL FROM from-address@place.net, RCPT TO to-address@place2.net, etc!
Hello, Lewin!
You wrote  on 7 May 2004 04:18:58 -0700:

 LAW> Do you mean CLIENT (send mail) or SERVER (receive inbound SMTP
 LAW> connections)? The simplest possible client is a function of about a
    I need CLIENT, so it could be able to send mail outside of embedded
system.
LAW> dozen lines of C code that opens a connection to port 25 of the target
 LAW> SMTP server, and sends: MAIL FROM from-address@place.net, RCPT TO
 LAW> to-address@place2.net, etc!
    Yes, you understodd me correctly! So, I asked this question in order
someone pointed me some very simple source code with above mentioned
functions (MAIL_FROM, RCPT_TO etc.). Cause I would not like to grep in
sendmail/postfix code :)
    Could you? I'd appreciate highly!

With best regards, Roman Mashak.  E-mail: mrv@tusur.ru


> Could you? I'd appreciate highly!
I think way easier to implement this kind of client would be to read the RFC in question. Once you understand the SMPT protocoll (which is really very simple) implementing this code on your own is a matter of half a day or so. Understanding and porting someone elses code is maybe half a day or so... :-) http://www.faqs.org/rfcs/rfc2821.html Jeremy Bentham's TCP/IP lean also contains a little charpter on the subject, but I doubt that this otherwise excellent book is worth it to buy for this purpose only. Markus
> LAW> connections)? The simplest possible client is a function of about a
> Yes, you understodd me correctly! So, I asked this question in order > someone pointed me some very simple source code with above mentioned
Honestly, I haven't written one. I just know how I would go about it, and I know that a minimal, non-RFC-compliant implementation (practically no error checking, for instance) would be about a dozen lines of C.
CodeProject.com has several SMTP client implementation. Just visit their
website and type SMTP in the search box.

The implementations are for Windows but they can be easily customized
to run on Linux.

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Real-time and Embedded System Design CASE Tool