User forums > General (but related to Code::Blocks)
What do you use for sending and reciving emails, POP3 or IMAP
StingRay:
--- Quote from: thomas on June 25, 2006, 02:48:33 pm ---To understand how it is one, the best would be to read the RFCs on the web (or invest in the book by Wright/Stevens).
Basically they all work more or less the same:
You make a simple socket connection, and you send a 4-byte command (such as USER, PASS, RCPT, or STAT) telling the server what you want, and you get back a reply. You can play with this via telnet. Try telnet yourpop3server 110, then type USER yourusername, followed by PASS yourpassword, and then STAT. You'll get a listing of your mail (if there is any) and you can then for example use RETR 1 to get message number 1.
A mail client does nothing else. Well, a bit more maybe, since there are other authentication methods than plaintext passwords, and many advanced features... but basically that's it.
You have to know what the commands are and when you may use which one, all of that is well documented in the RFCs.
A working open source implementation is for example in PHP and (obviously) Thunderbird.
--- End quote ---
Hey, thanks! That helps a lot. I'm trying the telnet example now. It is really simple, at least that much... I'll play with this and go from there! Thanks for your help.
Rick
Outis:
Sorry for warming up an old topic. I'm going to do rather the same StingRay wanted to do. My problem is the implementation with wxSocket: I think events are in this case unpractical, because an OnInput function doesn't (and shouldn't IMO) know, what was sent to the server before. Thus I decided to use wxSocket without events in a thread, but it doesn't work. This is probably because I'm new with sockets at all and I would be very pleased if someone of you could give me a short example which for example connects to a server, receives the "welcome" string, writes the "HELO" message back and receives again the answer. That's my try:
--- Code: ---
//...get hostname and port...
wxIPV4address addr;
addr.Hostname(hostname);
addr.Service(port);
wxSocketClient* m_socket = new wxSocketClient();
m_socket->SetFlags(wxSOCKET_NONE);
m_socket->SetTimeout(10);
if(!m_socket->Connect(addr, true))
return;
m_socket->Read(buffer, 2048);
len = m_socket->LastCount();
//...print the buffer...
m_socket->Write("HELO", 5); // 5 or 4? or: with or without the termination? [EDIT]ouch. newline forgotten[/EDIT]
m_socket->Read(buffer2, 2048);
len = m_socket->LastCount(); // len it's 0 (!) but the server _must_ response, tested with telnet
//..print again...
--- End code ---
[EDIT]How can I use events here? Would be a better style, I think[/EDIT]
Thanks.
jomeggs:
--- Quote from: StingRay on June 25, 2006, 02:31:57 pm ---Is there a library / source code that is used by others. I figured since wxEmail hadn’t been developed further that there was probably something else out there that people were using.
--- End quote ---
look here: http://libsmtp.berlios.de/
Navigation
[0] Message Index
[*] Previous page
Go to full version