SMTP Library?

Started by
7 comments, last by ro4tub 18 years, 7 months ago
I need to send e-mail from a C++ application via SMTP. Are there any good UNIX libraries? Google is suprisingly empty.
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
Advertisement
What's wrong with piping the mail message into "/sbin/sendmail -e" using popen()? sendmail will know how to, in turn, use SMTP, even if it's not actually a receiving host.
enum Bool { True, False, FileNotFound };
What address would that mail from?
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
I don't have the needed permissions to access sendmail. Crykies.
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
You need to look up the SMTP protocol. It's not very hard, it's a text-based protocol with maybe a dozen really significant commands. Google for an SMTP protocol tutorial, then telnet to your SMTP server and play around a bit.
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192
As it was said, sending mail through SMTP is easy. Just simply try telnet MAILSERVER 25 & then:
EHLO localhost\n>>MAIL FROM: <mailfrom>\n>>RCPT TO: <mailto>\n>>DATA\n>>From: mailfrom\nTo: mailto\nSubject: subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=1251\nSome text info\n.\n


That's all. Hope this will help you. But also look http://www.faqs.org/rfcs/rfc2821.html

Lekha
Quote:Original post by Vasialek
As it was said, sending mail through SMTP is easy. Just simply try telnet MAILSERVER 25 & then:
EHLO localhost\n>>MAIL FROM: <mailfrom>\n>>RCPT TO: <mailto>\n>>DATA\n>>From: mailfrom\nTo: mailto\nSubject: subject\nMIME-Version: 1.0\nContent-Type: text/html; charset=1251\nSome text info\n.\n


That's all. Hope this will help you. But also look http://www.faqs.org/rfcs/rfc2821.html

Lekha


Minor note, those need to be CRLF (\r\n) not just LF (\n) after each command.

-Halo7
According to man it should be \r\n, but in practice not in all cases :( I had troule w/ some mail servers. Better to use some var endLine & possibility for user to switch \n or \r\n. At least it was my solution
Maybe this is what u want
http://nbsmtp.ferdyx.org/html/smtp_8c-source.html

This topic is closed to new replies.

Advertisement