Download a comic strip and email to myself with Ruby?

using Ruby on my local Windows machine, can I easily write a script to
download a comic strip every day and email it to myself?

such as
http://comics.com/peanuts

On Tue, May 26, 2009 at 10:54 AM, SpringFlowers AutumnMoon
[email protected] wrote:

using Ruby on my local Windows machine, can I easily write a script to
download a comic strip every day and email it to myself?

such as
http://comics.com/peanuts

Yes

Andrew T.
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings

I would use Hpricot to parse the HTML and get the image, then any of the
Ruby email libraries to send it to yourself. It’s really a trivial
problem,
but if you’re having specific issues, I’m sure many of the people on
this
list would be willing to help.

Alex

Andrew T. wrote:

On Tue, May 26, 2009 at 10:54 AM, SpringFlowers AutumnMoon
[email protected] wrote:

using Ruby on my local Windows machine, can I easily write a script to
download a comic strip every day and email it to myself?

such as
http://comics.com/peanuts

Yes

how is it done?

On Tue, May 26, 2009 at 8:57 PM, Alex [email protected] wrote:

I would use Hpricot to parse the HTML and get the image, then any of the
Ruby email libraries to send it to yourself. It’s really a trivial problem,
but if you’re having specific issues, I’m sure many of the people on this
list would be willing to help.

Alex

Even easier, find out how the images are named because they are often
named yyyymmdd.jpg or similar and then just try and pull the image for
the day in question.
404 - no image
200 - you’ve got it

Andrew T.
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings

Jian L. wrote:

using Ruby on my local Windows machine, can I easily write a script to
download a comic strip every day and email it to myself?

such as
http://comics.com/peanuts

As for downloading a file:

Alex wrote:

I would use Hpricot to parse the HTML and get the image, then any of the
Ruby email libraries to send it to yourself. It’s really a trivial
problem,
but if you’re having specific issues, I’m sure many of the people on
this
list would be willing to help.

is it true that we just use the smtp.my-isp.com to send it? is there
any other way?

You can use any SMTP server to email the images. I would just use
Net::SMTP
with whatever SMTP server you happen to be using. It’s true that some
ISPs
offer SMTP servers, but smtp.<your_isp>.com may not be the naming
convention
that your ISP uses.

Remember, you’re going to need to attach the image to the email as well,
so
you’ll need to create a multipart message, with the image data encoded
in
base64. I’m sure there’s a library that can handle that for you,
although
I’m not very familiar with using ruby to manipulate email messages.

Alex