TIGSource Forums

Developer => Technical => Topic started by: brog on December 09, 2009, 04:14:10 AM



Title: sending/receiving email
Post by: brog on December 09, 2009, 04:14:10 AM
I want to write a program which can send and receive email messages.  Because I'm lazy and I detest network programing, I don't want to implement SMTP/POP3/MIME myself straight on top of winsock.  But my searches for a library that does this for me have come up empty.  Well, not empty; full of so much crap that I can't sort out what's any good.

Anyone have any advice on libraries to use?  (Or you could tell me it's not actually so bad to do it myself.)


Title: Re: sending/receiving email
Post by: Ivan on December 09, 2009, 09:57:04 AM
Maybe just use libcurl and do your email sending/receiving on a web server?


Title: Re: sending/receiving email
Post by: Tycho Brahe on December 09, 2009, 03:19:29 PM
Actually, I'm interested in doing this as well, has anyone had any experiences, good AND bad about sending/recieving email using c++


Title: Re: sending/receiving email
Post by: brog on December 09, 2009, 03:26:48 PM
Maybe just use libcurl and do your email sending/receiving on a web server?

The point of this exercise is to not require a server.  I'm contemplating doing a play-by-email game.  I've been inspired by Solium Infernum, but the method that uses is a little absurd - you have to manually send attachments and then save them to the correct folder.  I'd like my game to send off your turn itself, and then be able to run in the background, check every so often, and then pop up a message when a new turn arrives.


Title: Re: sending/receiving email
Post by: Ivan on December 09, 2009, 11:24:05 PM
Is there a reason to use such an archaic system though? Maybe you could do the same thing with something like twitter?


Title: Re: sending/receiving email
Post by: Tycho Brahe on December 10, 2009, 03:16:24 AM
To answer for him, he probably could, but not everyone has twitter, but everyone has email.


Title: Re: sending/receiving email
Post by: Ben Kuhn on December 10, 2009, 07:36:57 PM
Are you stuck with C++ for sure? Python's standard library includes POP, IMAP and SMTP libraries (and I'm sure Ruby and Perl do as well), so it's portable and you don't have to worry about external dependencies. Plus if it's a play-by-email thing you sure don't care about the loss in speed.

On the other hand, if you're dead set on C++, this page supplies a POP3 implementation: http://www.ddj.com/cpp/184404355 (http://www.ddj.com/cpp/184404355). And Wikipedia says SMTP "is a relatively simple, text-based protocol", so shouldn't be too tough to roll your own.


Title: Re: sending/receiving email
Post by: brog on December 12, 2009, 09:33:25 AM
Just because it's play-by-email doesn't mean I don't want 3d graphics with real-time lighting!

But yeah, it doesn't look too unreasonable to implement it myself.  Maybe I will.  Or maybe I'll set up Ruby or Python to be used as a scripting language with C++; I've always wanted an excuse to do that.  Sounds like fun, thanks for the advice.
It does seem weird that there isn't a standard email library for C++ though.