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. Advertising

  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. Advertising

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. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    188
    Henrik Ormåsen
    Aug 19, 2006
  2. Adam Akhtar
    Replies:
    1
    Views:
    201
    Eric Hodel
    Dec 15, 2008
  3. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

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

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    0
    Views:
    250
    Abhishiv Saxena
    Jul 3, 2009
  5. Ted Byers
    Replies:
    0
    Views:
    271
    Ted Byers
    Mar 20, 2009
Loading...

Share This Page