# Checking emails with ruby

**URL:** <https://www.ruby-forum.com/t/checking-emails-with-ruby/152462>\
**Category:** Ruby\
**Created:** [November 4, 2008, 8:52am UTC](https://www.ruby-forum.com/t/checking-emails-with-ruby/152462 "2008-11-04T08:52:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erika](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/47e85d/32.png) [@erika](https://www.ruby-forum.com/u/erika)\
**Post date:** [November 4, 2008, 8:52am UTC](https://www.ruby-forum.com/t/checking-emails-with-ruby/152462/1 "2008-11-04T08:52:24Z")

</div>

Hi,

Is there a possibility in ruby or with a ruby extension for checking  
emails?

I’m thinking something like the following:

- ruby accesses a site and after a button is pressed an email is send to  
an address
- ruby opens the mail handler (Outlook express / Thunderbird) and waits  
that the email is downloaded
- opens the email (the email can be identified by it’s subject)
- check if some text can be found in the email

Is this possible?

Thank you.

Br,  
Erika

---

<div class="post-metadata">

**Author:** ![erika](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/47e85d/32.png) [@erika](https://www.ruby-forum.com/u/erika)\
**Post date:** [November 4, 2008, 9:11am UTC](https://www.ruby-forum.com/t/checking-emails-with-ruby/152462/2 "2008-11-04T09:11:09Z")

</div>

It’s possible, depending on the type of email account, and can be done  
without relying on an external application. Check into the net/pop3  
and net/imap core libraries.

[http://www.ruby-doc.org/core/classes/Net/POP3.html](http://www.ruby-doc.org/core/classes/Net/POP3.html)  
[http://www.ruby-doc.org/core/classes/Net/IMAP.html](http://www.ruby-doc.org/core/classes/Net/IMAP.html)

The examples for either are good starting points.

---

<div class="post-metadata">

**Author:** ![erika](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/47e85d/32.png) [@erika](https://www.ruby-forum.com/u/erika)\
**Post date:** [November 4, 2008, 9:11am UTC](https://www.ruby-forum.com/t/checking-emails-with-ruby/152462/3 "2008-11-04T09:11:44Z")

</div>

* * *

From: Erika [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
Sent: Tuesday, November 04, 2008 1:20 PM  
To: ruby-talk ML  
Subject: checking emails with ruby

```
Hi,

```

Is there a possibility in ruby or with a ruby extension for  
checking emails?

I’m thinking something like the following:

- ruby accesses a site and after a button is pressed an email is  
send to an address
- ruby opens the mail handler (Outlook express / Thunderbird)  
and waits that the email is downloaded
- opens the email (the email can be identified by it’s subject)
- check if some text can be found in the email

I believe it will be easier if you choose to (and can) avoid  
Outlook/Thunder and read the mails via Ruby itself.  
Reading mails from a POP/IMAP server is quite easy.  
(For POP3)  
[http://www.ruby-doc.org/stdlib/libdoc/net/pop/rdoc/index.html](http://www.ruby-doc.org/stdlib/libdoc/net/pop/rdoc/index.html)
