You are not logged in.
I've got some C code I've been using to send an e-mail, but the code uses a system call to Postfix to do it. I'd like the code to be completely independent of Postfix; i.e., I don't want the end user to have to install and start the postfix daemon (or any other mail server) to use my code. Since I do not care about receiving e-mails (which would naturally require a daemon to be running all the time looking for the incoming data), but only sending an e-mail, is there a way in C code to simply send an e-mail, without dealing with a mail server? Ultimately, at some level, postfix is written in C so some part of it is able to autonomously send an e-mail... Does anyone know how that works?
Offline
RFC for the SMTP protocol
Offline
Use a smtp lib.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Presence of /usr/sbin/sendmail (which does not need to be THE sendmail itself; all decent MTAs provide sendmail-compatible interface) is required by LSB, so you should not worry about it on most systems. On the other hand, some of them may be configured for local delivery only, or not at all...
Offline
Hrm.. I know that when I first set up Arch Linux I did not have /usr/sbin/sendmail - I had to install Postfix (or a similar MTA) to get that binary. As such, and also because of what briest pointed out (that the system might not be configured for non-local delivery), I'd like to write my own sendmail() per se into my C code, rather than rely on /usr/sbin/sendmail.
I searched on google a bit for a free, open-source SMTP library and was able to find Emacs SMTP Library (http://www.gnu.org/software/emacs/manua … pmail.html) and vmime (http://www.vmime.org). But my question with these is, if I install the SMTP library and use it in my code, will not the end user also have to have an SMTP library installed to be able to compile my code?
Offline
But my question with these is, if I install the SMTP library and use it in my code, will not the end user also have to have an SMTP library installed to be able to compile my code?
Not if you statically link it. You can do that with the -l (lowercase L) flag in gcc — for example, `gcc -l smtp foo.c -o foo`. However, the gcc(1) manpage doesn't [from my brief glance] make it clear whether that performs dynamic or static linking.
# Wait, sorry, I thought you were talking about using — not compiling — the code. Yes, they will probably need to have the library installed, but such is the case with many projects.
Last edited by Peasantoid (2009-06-02 19:30:43)
Offline