Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » Bazaar » WebMail package (POP/SMPT/IMAP)
WebMail package (POP/SMPT/IMAP) [message #18316] Mon, 22 September 2008 17:05 Go to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Hi,

I am working on a WebMail package, which will include the below classes:

MailSocket (actually, this class is created with the U++ SmtpMail code)

EMail   
POP3Mail
SMTPMail (I know there is already a SmtpMail, but I found it hardly useful).
IMAP 


Althoug the WebMail package is under heavy development, I would like to upload the source code here, for I will not add this class to the SVN until it becomes fully productive.

Currently, only the POP3Mail class is complete (has APOP) and EMail class can only parse plain text mails (other MIME types will be supported with a MIMEParser, but it's another story.

I've created a simple multihreading POP3 mail reader example, which I hope will give you an idea what can be done.


I would like to know your opinions. Also any feedbacks, help and criticisms are apperciated.

Regards.

[Updated on: Wed, 24 September 2008 01:33]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #18317 is a reply to message #18316] Mon, 22 September 2008 17:07 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Here is the Simple mail reader:

index.php?t=getfile&id=1389&private=0
Re: WebMail package (POP/SMPT/IMAP) [message #18320 is a reply to message #18317] Mon, 22 September 2008 19:03 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1031
Registered: March 2006
Location: Italy
Experienced Contributor
[quote title=Oblivion wrote on Mon, 22 September 2008 17:07]Here is the Simple mail reader:
quote]

Hi Oblivion!

The program compiled without problem but didn't work: it crashed when I entered the site address like mail.vegachess.com.
Then I entered the numeric format xxx.yyy.uuu.vvv and it tried to connect but without success and without crush:
POP3Mail Error: Cannot open socket 216.115.108.245:110: Reason: socket(1660) / connect(216.115.108.245:110): Connection timed out. (WSAETIMEDOUT)

Instead with thunderbird I was able to connect without time delay.
Any idea?

It would be very nice to have saved one time for all the settings of the window "Account and Server Settings" and avoid to retype it each time. So the program should retrieve in some config file the last used parameters.

Luigi
Re: WebMail package (POP/SMPT/IMAP) [message #18321 is a reply to message #18320] Mon, 22 September 2008 19:26 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
forlano wrote on Mon, 22 September 2008 20:03

Oblivion wrote on Mon, 22 September 2008 17:07


Here is the Simple mail reader:



Hi Oblivion!

The program compiled without problem but didn't work: it crashed when I entered the site address like mail.vegachess.com.
Then I entered the numeric format xxx.yyy.uuu.vvv and it tried to connect but without success and without crush:
POP3Mail Error: Cannot open socket 216.115.108.245:110: Reason: socket(1660) / connect(216.115.108.245:110): Connection timed out. (WSAETIMEDOUT)

Instead with thunderbird I was able to connect without time delay.
Any idea?

It would be very nice to have saved one time for all the settings of the window "Account and Server Settings" and avoid to retype it each time. So the program should retrieve in some config file the last used parameters.

Luigi


Hmm... Crying or Very Sad

Confirmed. It works flawlesly when comipled with MSVC8 and MSVC9. But I reproduced the errors you mention on MinGW(did I mention that I hate that ever-complaining compiler? Very Happy) Probably a "reference" related bug, Also, the example should already "serialize" the settings window's content. I dont get it why it doesn't save and load the settings on MinGW. I'll try to find reason for this and I'll fix the problems asap.

Thanks.
Re: WebMail package (POP/SMPT/IMAP) [message #18322 is a reply to message #18316] Mon, 22 September 2008 19:37 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Gotcha!
I've fixed the problem. And updated the package. Could you please test it again. I need confirmation. Smile Also, serialization should work too.

Thank you

Regards.

[Updated on: Mon, 22 September 2008 19:42]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #18326 is a reply to message #18322] Mon, 22 September 2008 20:38 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1031
Registered: March 2006
Location: Italy
Experienced Contributor
Oblivion wrote on Mon, 22 September 2008 19:37

Gotcha!
I've fixed the problem. And updated the package. Could you please test it again. I need confirmation. Smile Also, serialization should work too.

Thank you

Regards.


Serialization works. But still I experience a server timed out. Perhaps is my server?
I'll try to compile with MCV9 as soon as possible.
Luigi
Re: WebMail package (POP/SMPT/IMAP) [message #18327 is a reply to message #18326] Mon, 22 September 2008 20:57 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Interesting. I didn't encounter any timeout errors after fixing the problem. Did you check your mail servers settings from thunderbird? Timeout error is likely to happen if your server is using TSL or SSL, or if you are trying to connect at a IMAP server. (POP3Mail class doesn't support TLS or SSL - not yet). Anyways, I'll examine the situation... Thanks.


Regards.

[Updated on: Mon, 22 September 2008 20:58]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #18329 is a reply to message #18327] Mon, 22 September 2008 21:44 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1031
Registered: March 2006
Location: Italy
Experienced Contributor
Oblivion wrote on Mon, 22 September 2008 20:57

Interesting. I didn't encounter any timeout errors after fixing the problem. Did you check your mail servers settings from thunderbird? Timeout error is likely to happen if your server is using TSL or SSL, or if you are trying to connect at a IMAP server. (POP3Mail class doesn't support TLS or SSL - not yet). Anyways, I'll examine the situation... Thanks.

Regards.



The timed out error disappeared after I used the correct IP Embarassed , but no emails were retrieved. Tested with MSC9 with the same null result.
I saw that it is difficult (impossible) to exit the program when it is running and the program crush if I press two times read email.

Thanks,
Luigi
Re: WebMail package (POP/SMPT/IMAP) [message #18330 is a reply to message #18327] Mon, 22 September 2008 22:08 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Quote:

(POP3Mail class doesn't support TLS or SSL - not yet

What are your plans for this? It would be great to work with a single Upp SSL package that could be used for many things like web, ftp, mail, etc... Or will they all be specific implementations anyway?
Re: WebMail package (POP/SMPT/IMAP) [message #18333 is a reply to message #18330] Tue, 23 September 2008 05:24 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Just found this: http://www.stunnel.org/
Quote:

Stunnel -- Universal SSL Wrapper
Stunnel is a program that allows you to encrypt arbitrary TCP connections inside SSL (Secure Sockets Layer) available on both Unix and Windows.
Re: WebMail package (POP/SMPT/IMAP) [message #18344 is a reply to message #18333] Tue, 23 September 2008 20:56 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

I`ve just tried your MailReader application. It managed to read all the headers from my mail account by POP3 protocol:
Quote:

+OK
USER ************
+OK Password required for user ********
PASS ************
+OK ************* maildrop has 133 messages (155829248 octets)
STAT
+OK 133 155829248
LIST
UIDL
QUIT
+OK POP3 server at ******* signing off
Everything worked if I tick "Transcript" ckeckbox (no idea what that means). Without "Transcript" checked program fails to connect to server (no debug info shown) with GPF exception from time to time.

U++: latest SVN build
OS: WinXP SP2
Re: WebMail package (POP/SMPT/IMAP) [message #18349 is a reply to message #18344] Wed, 24 September 2008 01:33 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Mindtraveller wrote on Tue, 23 September 2008 21:56

I`ve just tried your MailReader application. It managed to read all the headers from my mail account by POP3 protocol:
Quote:

+OK
USER ************
+OK Password required for user ********
PASS ************
+OK ************* maildrop has 133 messages (155829248 octets)
STAT
+OK 133 155829248
LIST
UIDL
QUIT
+OK POP3 server at ******* signing off
Everything worked if I tick "Transcript" ckeckbox (no idea what that means). Without "Transcript" checked program fails to connect to server (no debug info shown) with GPF exception from time to time.

U++: latest SVN build
OS: WinXP SP2


Yes, you're right. I've changed the "transcript" to "enable logging". I hope this makes sense. As to the General page fault you mention, I've updated the code. It should be fixed now...
I would be grateful if you could test the new source.

Forlano wrote on Mon, 22 September 2008 22:44


The timed out error disappeared after I used the correct IP Embarassed , but no emails were retrieved. Tested with MSC9 with the same null result.
I saw that it is difficult (impossible) to exit the program when it is running and the program crush if I press two times read email.



Yes, it is because the socket is currently in blocking mode. I am going to make it a nonblocking socket but, frankly, I'm a little bit troubled with U++ Socket class since there is no documentation about it. Neither the MT forum topics nor the Httpcli/srv examples helped me much... If possible, I don't want to rewrite the whole code in pure Win32 and X11, so can someone briefly explain the necessary steps to be taken in creating nonblocking sockets with U++? Also, how can I use that SocketEvent class (which seems to be defined only under Win32)?


captainc wrote on Mon, 22 September 2008 23:08


What are your plans for this? It would be great to work with a single Upp SSL package that could be used for many things like web, ftp, mail, etc... Or will they all be specific implementations anyway?



Well It's really a good idea to have a single SSL wrapper. But it also might be very time consuming. Smile OTOH, I can give it a try (but I have a lot of things waiting to be finished on my TODO list.That's why I wrote "not yet". The WCS classes and this WebMail package is on top of my list now. But again, it is worth trying).


Re: WebMail package (POP/SMPT/IMAP) [message #18408 is a reply to message #18349] Sat, 27 September 2008 22:02 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Tested new sources. Seems to work without problem. Headers are fetched OK. Messages don`t seem to be fetched at all, even with "Download full messages" ticked.

Also, I`ll try to help with U++ socket classes as soon I have spare time.
Re: WebMail package (POP/SMPT/IMAP) [message #20841 is a reply to message #18316] Mon, 13 April 2009 19:41 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

What about smtp? I'll need to send a simple mail with one or two files. So I'm thinking about the more simple and fast variants. Can you help me with a simple code-snippet or advice?

It will be great, if you could show a "conversation" with the socket, it will help to realize how to send a mail with attachments successfully. And I don't know much more about MIME format, and about free tools for it, >_<.

And I'm going to search the answers myself too, yeh, of cause.

Best regards, great man, and sorry for my English,
Anton.
Re: WebMail package (POP/SMPT/IMAP) [message #20844 is a reply to message #20841] Mon, 13 April 2009 23:57 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
Quote:


What about smtp? I'll need to send a simple mail with one or two files. So I'm thinking about the more simple and fast variants. Can you help me with a simple code-snippet or advice?

It will be great, if you could show a "conversation" with the socket, it will help to realize how to send a mail with attachments successfully. And I don't know much more about MIME format, and about free tools for it, >_<.

And I'm going to search the answers myself too, yeh, of cause.

Best regards, great man, and sorry for my English,
Anton.



Hello Anton,

Actually, the code of this "yet-to-be-finished" (I'm sorry, I'm way too busy nowadays... I didn't have the time to finish it) class is based upon the original U++ SmtpMail class. So you should check "SMTPMail::Send()" method in Web/smtp.h. It will give you an idea about the socket "transaction" (or conversation, if you will). It works almost like my unfinished POP3Mail class.

Smtp example code should be something like this:

#ifndef _SmtpExample_SmtpExample_h
#define _SmtpExample_SmtpExample_h

#include <CtrlLib/CtrlLib.h>
#include <Web/Web.h>
using namespace Upp;

#define LAYOUTFILE <SmtpExample/SmtpExample.lay>
#include <CtrlCore/lay.h>

class SmtpExample : public WithSmtpExampleLayout<TopWindow> {
public:
	typedef SmtpExample CLASSNAME;
	SmtpExample();
	
	SmtpMail smtp;
	
	void	Send();
};

SmtpExample::SmtpExample()
{
	CtrlLayout(*this, "Smtp Example");
	
	smtp.Transcript();
	smtp.Subject("Smtp Example");
	smtp.Port(25);
	smtp.Host("smtp.host.com");
	smtp.Auth("username", "password");
	smtp.From("from");
	smtp.To("to");
	smtp.AttachFile("filename", mimetype = 0);
	SendButton << THISBACK(Send); 

}

void SmtpExample::Send()
{
	smtp.Send();
	LogConsole.Set(smtp.GetTranscript());
}


GUI_APP_MAIN
{
	SmtpExample().Run();
}


But beware, this code probably won't work; because most of the servers require at least a TLS encryption/session after the first "HELO" message.

For more information on SMTP protocol you should read RFC 821 and RFC 5321.

You can read and search POP3/SMTP/MIME/TLS/SLL etc. RFC documents at:

http://www.rfc-editor.org/rfcsearch.html

I hope that this will give you an idea on where to start.

Regards.

Oblivion

[Updated on: Tue, 14 April 2009 00:01]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #20870 is a reply to message #20844] Wed, 15 April 2009 13:46 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

You solved my problem. Thank you.

[Updated on: Wed, 15 April 2009 13:47]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #28245 is a reply to message #18316] Wed, 25 August 2010 09:01 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

Hello!

What news about POP/SMPT/IMAP?

Is it the latest version?
If not where can I download the latest version?
I'm interested in this and want to test and improve if will need.

Thank you in advance!
Ion.

Oblivion wrote on Mon, 22 September 2008 18:05

Hi,

I am working on a WebMail package, which will include the below classes:

MailSocket (actually, this class is created with the U++ SmtpMail code)

EMail   
POP3Mail
SMTPMail (I know there is already a SmtpMail, but I found it hardly useful).
IMAP 


Althoug the WebMail package is under heavy development, I would like to upload the source code here, for I will not add this class to the SVN until it becomes fully productive.

Currently, only the POP3Mail class is complete (has APOP) and EMail class can only parse plain text mails (other MIME types will be supported with a MIMEParser, but it's another story.

I've created a simple multihreading POP3 mail reader example, which I hope will give you an idea what can be done.


I would like to know your opinions. Also any feedbacks, help and criticisms are apperciated.

Regards.



[Updated on: Wed, 25 August 2010 09:01]

Report message to a moderator

Re: WebMail package (POP/SMPT/IMAP) [message #28282 is a reply to message #28245] Wed, 25 August 2010 16:53 Go to previous message
Oblivion is currently offline  Oblivion
Messages: 536
Registered: August 2007
Location: Turkey
Contributor
tojocky wrote on Wed, 25 August 2010 10:01

Hello!

What news about POP/SMPT/IMAP?

Is it the latest version?
If not where can I download the latest version?
I'm interested in this and want to test and improve if will need.

Thank you in advance!
Ion.

Oblivion wrote on Mon, 22 September 2008 18:05

Hi,

I am working on a WebMail package, which will include the below classes:

MailSocket (actually, this class is created with the U++ SmtpMail code)

EMail   
POP3Mail
SMTPMail (I know there is already a SmtpMail, but I found it hardly useful).
IMAP 


Althoug the WebMail package is under heavy development, I would like to upload the source code here, for I will not add this class to the SVN until it becomes fully productive.

Currently, only the POP3Mail class is complete (has APOP) and EMail class can only parse plain text mails (other MIME types will be supported with a MIMEParser, but it's another story.

I've created a simple multihreading POP3 mail reader example, which I hope will give you an idea what can be done.


I would like to know your opinions. Also any feedbacks, help and criticisms are apperciated.

Regards.






Hello tojocky

Unfortunately, I have no spare time to develop this project all by myself (I have a job, and a PhD thesis to complete). But if someone will volunteer to takes over this project or help me, I will gladly help him and contribute to it Smile

Recently I have added a basic and simple SSL & TLS support to the MailSocket class, and it seems to be working fine. Please feel free to modify, improve and maintain the package. If you would like to further develop WebMail class, there are some points you should know:

1. MailSocket class is a blocking socket and it should be made nonblocking.

2. POP3Mail class is almost complete. But, as always, it could be improved.

3. EMail parser class is only a scratch. It needs to be developed.

4. There is no SMTPMail class yet, but once MailSocket class is complete (made nonblocking), it should be relatively easy to create one.

One more thing: Since WebMail has basic SSL/TLS support, you will need OpenSSL packages to get the package compiled.

On Windows, you can download it from http://www.openssl.org

On Linux (on *buntu distros, at least), you should install "libssl-dev" package.

Regards

[Updated on: Wed, 25 August 2010 16:55]

Report message to a moderator

Previous Topic: SCGI Server Class
Next Topic: Docking - Strange behaviour with GlCtrl
Goto Forum:
  


Current Time: Tue Feb 19 19:51:21 CET 2019

Total time taken to generate the page: 0.00698 seconds