Duplicate:
any suggestion libraries?
You can just open a socket connection to a SMTP server and send the SMTP command using write() function.
It is a text based protocol and you can even just telnet into a SMTP server and create a mail manually.
Just check out SMTP protocol on Wikipedia.