[Gambas-user] Receiving an email

Benoît Minisini gambas at ...1...
Fri Jul 26 22:38:22 CEST 2013


Le 26/07/2013 20:58, Sprachschule Eilert a écrit :
> Hi Randall,
>
> I now got the gb.net.pop3 component to work, and your example works too.
> However, I only receive the message headers, not the message bodies, and
> the messages aren't downloaded and deleted from the server.
>
> This is what I got, when there were 3 messages in the inbox:
>
> Connected to mail server....
> +OK Hello there. <29021.1374864315 at ...37...>
> There are 3 Messages in your inbox.
> You inbox contains 7501 bytes of data.
> 1 802
> 2 5581
> 3 1118
> Message: 1 802
>
> ----------------------------------------------------
> +OK 802 octets follow.
>
>
> Message: 2 5581
>
> ----------------------------------------------------
> Received: (qmail 28836 invoked from network); 26 Jul 2013 19:35:08 +0200
>
>
> Message: 3 1118
>
> ----------------------------------------------------
> Received: from 95.58.25.201.megaline.telecom.kz (HELO 95.58.25.201)
> (95.58.25.201)
>
>
> Closing Connection.
>
>
> As soon as I know how to get complete messages (in my case, these would
> be the contact forms sent by customers via the contact form tool on my
> website), I would add the DELE command to clean them from the server.
>
> Rolf
>

You don't have to issue the POP3 commands explicitely with the 
Pop3Client class. Look at the documentation:

hConn.Count returns the number of messages.

hConn[i] returns the i-th message.

hConn[i].Size returns the message size.

hConn[i].Text returns the message contents "as is".

hConn[i].Message returns the message parsed as a MimeMessage object.

hConn[i].Delete marks the message as being deleted. It will be actually 
deleted when you call hConn.Close(), but not if you call hConn.Abort().

Then go look at the MimeMessage class documentation of gb.mime!

Regards,

-- 
Benoît Minisini




More information about the User mailing list