Can Ruby read emails?

D

david

I know Ruby can do a lot of neat stuff, I was just wondering if someone
has found a way to read emails from a gmail account. The reason is I'm
hoping to create a system that a user can email an account with a
command, and Ruby will read it and exacute that command. Any ideas /
suggestions?

david
 
H

Harry

I know Ruby can do a lot of neat stuff, I was just wondering if someone
has found a way to read emails from a gmail account. The reason is I'm
hoping to create a system that a user can email an account with a
command, and Ruby will read it and exacute that command. Any ideas /
suggestions?

david

I've never tried it but maybe this will work.
http://raa.ruby-lang.org/project/gmailer/

Harry
 
G

Giles Bowkett

For what it's worth, I read a thing where a guy used Python to mount
Gmail as a drive with Linux. That code could probably be translated
into Ruby relatively easily.
 
D

Daniel Martin

david said:
I know Ruby can do a lot of neat stuff, I was just wondering if someone
has found a way to read emails from a gmail account. The reason is I'm
hoping to create a system that a user can email an account with a
command, and Ruby will read it and exacute that command. Any ideas /
suggestions?

My reaction to such a scheme is "GAH! NOOOOOOOO!"

That has nothing to do with reading from gmail, and everything to do
with executing commands received via email.

(I managed to hose a university account royally after setting up a
similar system on VMS once)

Please implement some sort of authentication and extensive logging of
commands received and the results of executing them. You'll thank
yourself later. Also, protect against replay attacks - make sure that
receiving the same exact email twice won't cause commands to be
executed twice.
 
R

Richard Conroy

Well, this can be done and in fact has been done before many times. In
principal, this is not very different in concept from mail lists which allow
you to send commands to the list server to subscribe, unsubscribe or get
information on a particular list etc. In fact, back before the web and http,
systems that used e-mail to initiate some action/command were fairly common.

Yes, you can define some kind of plain-text verbage in the message body,
subject line etc.

The main problem you will encounter is that Net::SMTP has limitations
with respect to accessing GMail (I think its due to TLS, or something that
is currently unsupported).

As other posters have mentioned, you *really* do need to consider the
security implications.

Anyway, other suggestions - Ruby's Mail class is nice for parsing e-mail
files and received e-mails.

You might want to consider not building in Transport level stuff - i.e. don't
do POP3, IMAP or SMTP, but use a standard mail client that uses a disk
directory as your inbox (that you can monitor changes to).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,269
Latest member
vinaykumar_nevatia23

Latest Threads

Top