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

J

jasonnaylor

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:

(e-mail address removed)

A search function of:

imap.search(["TO", "(e-mail address removed)"])

.... 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", "(e-mail address removed)"])

.... 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="(e-mail address removed)",
route=nil, mailbox="080416w_test", host="this.dom.ain">]
<... snip...>
 
J

jasonnaylor

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

irb(main):107:0> imap.search(["TO", "(e-mail address removed)"])
=> [1174]

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

`[email protected]`
 

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,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top