Grabbing email attachments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Grabbing email attachments

Davide Varvello
Hi guys,
Is there a way to grab and save an attachment using Pharo?

TIA
Davide
Reply | Threaded
Open this post in threaded view
|

Re: Grabbing email attachments

Sven Van Caekenberghe-2
Davide,

On 11 Jun 2013, at 00:54, Davide Varvello <[hidden email]> wrote:

> Hi guys,
> Is there a way to grab and save an attachment using Pharo?

There is a SMTPClient and even a SecureSMTPClient. And there is support for ZnMimePart.
But I don't know exactly how to combine the two, although I think somebody once did on the list.
It could be as easy as just reading the raw message.

HTH,

Sven

> TIA
> Davide
>
>
>
> --
> View this message in context: http://forum.world.st/Grabbing-email-attachments-tp4692693.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

--
Sven Van Caekenberghe
Proudly supporting Pharo
http://pharo.org
http://association.pharo.org
http://consortium.pharo.org





Reply | Threaded
Open this post in threaded view
|

Re: Grabbing email attachments

Davide Varvello
Thank Sven, I'll look at them.

As Sven said, is there anyone on the list who managed SMTPClient and ZnMimePart?
I just searched for SecureSMTPClient but I only found a raw description of a brittle implementation (http://forum.world.st/Combining-SqueakSSL-and-SMTPClient-td2956892.html)

Davide

Sven Van Caekenberghe-2 wrote
Davide,

On 11 Jun 2013, at 00:54, Davide Varvello <[hidden email]> wrote:

> Hi guys,
> Is there a way to grab and save an attachment using Pharo?

There is a SMTPClient and even a SecureSMTPClient. And there is support for ZnMimePart.
But I don't know exactly how to combine the two, although I think somebody once did on the list.
It could be as easy as just reading the raw message.

HTH,

Sven

> TIA
> Davide
>
>
>
> --
> View this message in context: http://forum.world.st/Grabbing-email-attachments-tp4692693.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

--
Sven Van Caekenberghe
Proudly supporting Pharo
http://pharo.org
http://association.pharo.org
http://consortium.pharo.org
Reply | Threaded
Open this post in threaded view
|

Re: Grabbing email attachments

Sven Van Caekenberghe-2
Davide,

On 11 Jun 2013, at 08:40, Davide Varvello <[hidden email]> wrote:

Thank Sven, I'll look at them.

As Sven said, is there anyone on the list who managed SMTPClient and
ZnMimePart?
I just searched for SecureSMTPClient but I only found a raw description of a
brittle implementation
(http://forum.world.st/Combining-SqueakSSL-and-SMTPClient-td2956892.html)

Davide

Here is some more info (I had little time when I sent the previous reply).

ZdcSecurePOP3Client is normally in your image, else it can be found in Zodiac-Extra (http://mc.stfx.eu/Zodiac) and should work for GMail, for example:

ZdcSecurePOP3Client
retrieveMessagesFromGMailAccount: '<your-name>@gmail.com'
password: '<your-password>'
limit: 5.

Reading a multipart message goes like this:

'/Users/sven/Desktop/Test.eml' asFileReference readStreamDo: [ :stream | 
stream binary.
ZnMimePart readFrom: stream ].

Test.eml is a message that I sent to myself, containing an image. I just saved it from Apple Mail as raw text.

The result should be something like the following screenshot:



Note the nesting of mime parts.

Please do upgrade to Zinc #bleedingEdge as I had to make a couple of fixes to get mime part support up to date.

Good luck !

Sven

Sven Van Caekenberghe-2 wrote
Davide,

On 11 Jun 2013, at 00:54, Davide Varvello &lt;

varvello@

&gt; wrote:

Hi guys,
Is there a way to grab and save an attachment using Pharo?

There is a SMTPClient and even a SecureSMTPClient. And there is support
for ZnMimePart.
But I don't know exactly how to combine the two, although I think somebody
once did on the list.
It could be as easy as just reading the raw message.

HTH,

Sven

TIA
Davide



--
View this message in context:
http://forum.world.st/Grabbing-email-attachments-tp4692693.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

--
Sven Van Caekenberghe
Proudly supporting Pharo
http://pharo.org
http://association.pharo.org
http://consortium.pharo.org





--
View this message in context: http://forum.world.st/Grabbing-email-attachments-tp4692693p4692707.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Grabbing email attachments

Davide Varvello




From: Sven Van Caekenberghe <[hidden email]>
To: Any question about pharo is welcome <[hidden email]>
Sent: Tuesday, June 11, 2013 11:56 AM
Subject: Re: [Pharo-users] Grabbing email attachments

Davide,

Here is some more info (I had little time when I sent the previous reply).

ZdcSecurePOP3Client is normally in your image, else it can be found in Zodiac-Extra (http://mc.stfx.eu/Zodiac) and should work for GMail, for example:

I don't have it in my image, anyway no problem.

ZdcSecurePOP3Client
retrieveMessagesFromGMailAccount: '<your-name>@gmail.com'
password: '<your-password>'
limit: 5.

Reading a multipart message goes like this:

'/Users/sven/Desktop/Test.eml' asFileReference readStreamDo: [ :stream | 
stream binary.
ZnMimePart readFrom: stream ].

Test.eml is a message that I sent to myself, containing an image. I just saved it from Apple Mail as raw text.

The result should be something like the following screenshot:



Note the nesting of mime parts.




That's cool!
Thank you very much, Sven

Davide

Please do upgrade to Zinc #bleedingEdge as I had to make a couple of fixes to get mime part support up to date.

Good luck !

Sven


Sven Van Caekenberghe-2 wrote
Davide,

On 11 Jun 2013, at 00:54, Davide Varvello &lt;

varvello@

&gt; wrote:

Hi guys,
Is there a way to grab and save an attachment using Pharo?

There is a SMTPClient and even a SecureSMTPClient. And there is support
for ZnMimePart.
But I don't know exactly how to combine the two, although I think somebody
once did on the list.
It could be as easy as just reading the raw message.

HTH,

Sven

TIA
Davide



--
View this message in context:
http://forum.world.st/Grabbing-email-attachments-tp4692693.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

--
Sven Van Caekenberghe
Proudly supporting Pharo
http://pharo.org
http://association.pharo.org
http://consortium.pharo.org





--
View this message in context: http://forum.world.st/Grabbing-email-attachments-tp4692693p4692707.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.