For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2007 > looking for small SMTP lib?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author looking for small SMTP lib?
Jim Marshall

2007-10-24, 7:18 pm

I need to write a small shared object that will send a mail message
under certain circumstances. I was going to use SMTP to do this (just
open a socket and send the message parsing what the server sends
etc...). But I would presume someone has done this before, but I could
not find anything (except full fledged SMTP libraries). I can not exec
sendmail or other processes.

Thanks
Rainer Weikusat

2007-10-25, 4:26 am

Jim Marshall <jim.marshall@wbemsolutions.com> writes:
> I need to write a small shared object that will send a mail message
> under certain circumstances. I was going to use SMTP to do this (just
> open a socket and send the message parsing what the server sends
> etc...). But I would presume someone has done this before, but I could
> not find anything (except full fledged SMTP libraries). I can not exec
> sendmail or other processes.


Below is a part of a 'mail sending script' used for some time
on the appliances I mostly work for:

cd $temp
printf "HELO lamer\r\n" >header
printf "MAIL FROM: %s\r\n" "$addr" >>header
printf "RCPT TO: %s\r\n" "$addr" >>header
printf "DATA\r\n" >>header

printf ".\r\nQUIT\r\n" >trailer

cat header - trailer | nc "$server" 25

It should be easy to adapt this for C.
Jörg Schmitz-Linneweber

2007-10-25, 4:26 am

Hi Jim!

Jim Marshall wrote:
> I need to write a small shared object that will send a mail message
> under certain circumstances. I was going to use SMTP to do this (just
> open a socket and send the message parsing what the server sends
> etc...). But I would presume someone has done this before, but I could
> not find anything (except full fledged SMTP libraries). I can not exec
> sendmail or other processes.

Perhaps you should have a look at libesmtp?
[ http://www.stafford.uklinux.net/libesmtp/ ]

HTH. Salut, Jörg

--
gpg/pgp key # 0xd7fa4512
fingerprint 4e89 6967 9cb2 f548 a806 7e8b fcf4 2053 d7fa 4512
Jim Marshall

2007-10-25, 7:14 pm

Jörg Schmitz-Linneweber wrote:
> Hi Jim!
>
> Jim Marshall wrote:
> Perhaps you should have a look at libesmtp?
> [ http://www.stafford.uklinux.net/libesmtp/ ]
>
> HTH. Salut, Jörg
>

thanks!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com