Author Topic: What do you use for sending and reciving emails, POP3 or IMAP  (Read 5900 times)

Offline StingRay

  • Single posting newcomer
  • *
  • Posts: 4
Hello!

I'm bran new to CodeBlocks & wxWidgets and playing around some.  And loving it!  

Quick question, wxWidgets does not seam to have much for sending and receiving emails, it has wxEmail which has a Send function.

What do you use for sending and receiving emails, POP3 or IMAP.

Again, just playing around and itís more curiosity than anything.

Thanks for your help.

Rick

Offline Blue-Tiger

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #1 on: June 25, 2006, 09:15:25 am »
usually POP3, but there's 1 mail-account (out of 3) where I use IMAP.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #2 on: June 25, 2006, 12:59:03 pm »
Quote
What do you use for sending and receiving emails, POP3 or IMAP.
Neither POP3 nor IMAP can be used to send emails.

Your question regarding wxEmail suggests you are intending to write an email client using wxWidgets, is that right?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline StingRay

  • Single posting newcomer
  • *
  • Posts: 4
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #3 on: June 25, 2006, 02:31:57 pm »
Quote
What do you use for sending and receiving emails, POP3 or IMAP.
Neither POP3 nor IMAP can be used to send emails.

Your question regarding wxEmail suggests you are intending to write an email client using wxWidgets, is that right?

Right.  I’d like to do it more to see how it is done than anything.

I understand using POP3, IMAP and SMTP from a client, but not form code.

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.

Thanks again.

Rick

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #4 on: June 25, 2006, 02:48:33 pm »
Right.  Iíd like to do it more to see how it is done than anything.

I understand using POP3, IMAP and SMTP from a client, but not form code.
To understand how it is done, 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline StingRay

  • Single posting newcomer
  • *
  • Posts: 4
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #5 on: June 26, 2006, 03:28:25 am »
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.

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

Offline Outis

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #6 on: April 07, 2007, 06:02:01 pm »
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: [Select]
   
    //...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...

[EDIT]How can I use events here? Would be a better style, I think[/EDIT]

Thanks.
« Last Edit: April 07, 2007, 06:31:20 pm by Outis »

Offline jomeggs

  • Multiple posting newcomer
  • *
  • Posts: 92
Re: What do you use for sending and reciving emails, POP3 or IMAP
« Reply #7 on: April 10, 2007, 12:57:05 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.

look here: http://libsmtp.berlios.de/