Jump to content
  • Advertisement
Sign in to follow this  
31337

SMTP Library?

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to send e-mail from a C++ application via SMTP. Are there any good UNIX libraries? Google is suprisingly empty.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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\n
To: mailto\n
Subject: subject\n
MIME-Version: 1.0\n
Content-Type: text/html; charset=1251\n
Some text info
\n
.
\n


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

Lekha

Share this post


Link to post
Share on other sites
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\n
To: mailto\n
Subject: subject\n
MIME-Version: 1.0\n
Content-Type: text/html; charset=1251\n
Some 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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!