net/imap - imap.search "TO" can't find email

Discussion in 'Ruby' started by jasonnaylor, Apr 16, 2008.

  1. jasonnaylor

    jasonnaylor Guest

    I'm having trouble with the "search" feature of Net::IMAP. I'm
    attempting to search for a message "TO" a particular recipient.

    The email recipient is something like:



    A search function of:

    imap.search(["TO", ""])

    .... simply returns nothing. By removing the mailbox details and only
    searching for the domain:

    imap.search(["TO", "@this.dom.ain"])

    .... I return results. In fact, I can build the "TO" string as long
    as:

    imap.search(["TO", ""])

    .... and results are returned.

    What don't I understand? Is it my limited knowledge of Ruby, or the
    imap.search I'm not understanding???

    Note: Here's the fetch "ENVELOPE" of the mail I'm after:

    irb(main):073:0* imap.fetch(1179, "ENVELOPE")
    <... snip...>
    , to=[#<struct Net::IMAP::Address name="",
    route=nil, mailbox="080416w_test", host="this.dom.ain">]
    <... snip...>
     
    jasonnaylor, Apr 16, 2008
    #1
    1. Advertisements

  2. jasonnaylor

    jasonnaylor Guest

    Interestingly, I can find the following (another entirely different
    message):

    irb(main):107:0> imap.search(["TO", ""])
    => [1174]

    So it appears something about the "_" character in the mailbox of the
    previous search might be the culprit:

    ``
     
    jasonnaylor, Apr 16, 2008
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. luke
    Replies:
    6
    Views:
    447
  2. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    357
    Henrik Ormåsen
    Aug 19, 2006
  3. Jon Fi
    Replies:
    4
    Views:
    1,000
    Kashia Buch
    Oct 21, 2006
  4. Adam Akhtar
    Replies:
    1
    Views:
    348
    Eric Hodel
    Dec 15, 2008
  5. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    4
    Views:
    379
    Eric Hodel
    Jul 4, 2009
  6. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    0
    Views:
    359
    Abhishiv Saxena
    Jul 3, 2009
  7. sam

    Can't find Cyrus::Imap module.

    sam, Dec 9, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    288
  8. Ted Byers
    Replies:
    0
    Views:
    414
    Ted Byers
    Mar 20, 2009
Loading...