Hello monks,

I come before you today seeking your wisdom and advice on using the Mail::IMAPClient module.

I have an email with the following subject:

test email "abc123" approved

When I search for this email as follows, I find the email:

my @uids = $imap->search("SUBJECT \"test email \"abc123\"\"")

However, if I try to search for the full subject name, I cannot find the email:

my @uids = $imap->search("SUBJECT \"test email \"abc123\" approved\"")

I've tried various other ways to search but to no avail. I only have this issue when double quotes are in the subject.

Has anyone experienced this before? Any help/advice would be great.

Thanks!

Update:

Here is the code I am using to search for a new email on my work's exchange server based on subject, to and from email addresses:

my $searchSubject = 'test email "abc123" approved'; sub search { my ($mailbox, $folder, $searchSubject, $searchFromAddress, $se +archToAddress) = @_; #Connecting to mailbox ... $imap->examine($folder); $imap->Uid(1); my @uids = $imap->search('UNSEEN', 'SUBJECT', $searchSubject, +'HEADER', 'FROM', $searchFromAddress, 'HEADER', 'TO', $searchToAddres +s);

If $searchSubject has double quotes in it, my code hangs at the $imap->search command.


In reply to Mail::IMAPClient and searching email subjects with double quotes by treize

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.