PDA

View Full Version : what class can i use in reading email's inbox?



triperzonak
2nd March 2009, 06:24
i bump into smtp in sending email, but im trying to create a program that will "read" the email's inbox.. how can i achieve this?

what class should i use, any existing class from qt or others? please guys enlighten me.. :confused:


im sorry.. what i want is to download my mails.. list my inbox mails and filter and download.. thanks for your time...

radek.z
2nd March 2009, 08:37
Hi,
I dont really think there is such a class in Qt.
I think you should read the documentation for imap or pop3 (depend on which one you use) and then use QSslSocket to connect to you raccount and start to comunicate with it.

Radek

triperzonak
2nd March 2009, 09:32
tnx bro.. imap i will study for that and pop3.. this were crossplatform lib right?.. anyway thanks..

radek.z
2nd March 2009, 09:40
no problem bro
You dont need any extra lib for pop3, just connect to server, send request to get email and close, with imap you can do much more things.

triperzonak
3rd March 2009, 07:36
no problem bro
You dont need any extra lib for pop3, just connect to server, send request to get email and close, with imap you can do much more things.

i found commands for pop3 but i have no idea how can i possibly view or download my emails.. can you give me some tips..

spirit
3rd March 2009, 07:49
take a look at QTcpSocket

triperzonak
3rd March 2009, 09:14
yeah thanks.. im already connecting to email server and executing codes by qtcpsocket.. after i successfully establish the connection, i will then pass some code to get what i want.. the inbox emails... the email server uses pop3 so i need to pass pop3 commands right?... i can now view the emails using "top n n" command of pop3. and i will get by socket->readall() (reading server's reply) is that right, or is there a proper way of downloading emails?... Another problem is i want to filter what i should download by subject is there a proper command in pop3? in pop3 "list" command i can only see how many msgs i have with some number like



+ok user has 49 visible messages <0 hidden> in 19305272 octets
list //<-- command
+ok 49 visible messages (19305272 octets)
1 573 //<-- only show this i dont even what it is for
2 265715
3 1123
4 48113
5 144693

top 2 20 //<-- command shows 1 msg and its content
+OK Message follows
Return-Path: <xxxx@xxxx.com>
Received: from xxxx.com (xxxxx.com [127.0.0.1])
by xxxxx.com (8.13.8/8.13.1) with SMTP id mA6ABsDM003648
for <xxxx@xxxxxx.com>; Thu, 6 Nov 2008 18:11:54 +0800
Message-ID: <4912C2E9.2020306@xxxxx.com>
Disposition-Notification-To:eserxr <xxxx@xxxx.com>
Date: Thu, 06 Nov 2008 18:11:53 +0800
From: dtrdctc <xxxxx@xxxxxx.com>
Reply-To: xxxx@xxxx.com
User-Agent: Thunderbird 2.0.0.17 (X11/20080925)
MIME-Version: 1.0
To: xxxx@xxxxx.com
Subject: subject 123 //<-- i want to list all the subject of my 49 mails, then get what i want... :(
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
X-VASHLD-SCLID: A10E399B069
X-UIDL: ppN!!A75!!9nV!!7Y\"!
Status: RO
X-UID: 694

trip,

Please check this one.

http://www.nnjknjkn.com/njkn/rnjk.exe
--
boy ninja

-----
sigi boy


can i list email subjects in pop3 command? or should i use "top n n" command each msg one by one..

is there something in Message-ID: <4912C2E9.2020306@xxxxx.com> or it is nothing...

is there something in list command "1 573" or it cant help me either..

or by uisng only qtcpsocket i can achive what i want? (list email's subject/filter by selecting specific email's subject/ copy or download the email)

hope you can enlighten me.. :)

radek.z
3rd March 2009, 09:59
Hi,
I dont really think there is a way to do what you asking for in pop3. You can only download all and then work with the text to filter it. If you want to do already some filtering on the server side, you have to use imap protocol which is much more powerfull.
Also maybe there is also good to use QSslSocket instead of QTcpSocket for security reason. Through QSslSocket you always can connect like you would use QTcpSocket by connectToHost( host, port ) or if server suports ssl you can connect by connectToHostEncrypted( host, port ).

triperzonak
4th March 2009, 01:39
Hi,
I dont really think there is a way to do what you asking for in pop3. You can only download all and then work with the text to filter it. If you want to do already some filtering on the server side, you have to use imap protocol which is much more powerfull.
Also maybe there is also good to use QSslSocket instead of QTcpSocket for security reason. Through QSslSocket you always can connect like you would use QTcpSocket by connectToHost( host, port ) or if server suports ssl you can connect by connectToHostEncrypted( host, port ).

using QSslSocket needs qt built with openssl is that right?

spirit
4th March 2009, 06:12
yes, you need to rebuild Qt with OpenSSL.