Jump to content

beidlerj

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by beidlerj

  1. If I only try this code:

     

    $matches = imap_search($link, "SUBJECT \"$keywords\"");
    

     

    I get an array of msg IDs that matched.  However, when I try this code:

     

    $matches = imap_search($link, "BODY \"$keywords\"");
    

     

    ...then the function returns false.  Is this a problem with the implementation, or is there some other "magic phrasing" I need to use, in order to search the body of messages for a keyword?

  2. Hello,

     

    I am having trouble getting any results back from the imap_search function.  I assume it has to do with getting the right query string.

     

    I am grabbing a string of keywords from an HTML form input box, and (trying to) search the IMAP inbox for messages which contain the $keywords string in either the BODY or the SUBJECT.  Can anyone lend some help with the correct string to send to the server?  I keep getting nothing back, meaning that the server doesn't understand the query.

     

    $link = imap_open($server, $UN, $PW) or die(imap_last_error());
    
    $matches = imap_search($link, "BODY \"$keywords\" SUBJECT \"$keywords\"");
    
    if ($matches === false)
    {
       echo "Server didn't understand query.<p>";
       echo imap_last_error();
    }
    

     

    Thanks,

     

    Jeff

     

  3. I figured out what you were getting at, a couple days after the fact.  Must have been short on sleep then... :)

     

    I was able to get images to display without storing them first.  Just did a simple show script that kicks out the content-type header and the image, but can be referenced in the <img> tag as the source... basically like returning a file, but just a stream of data.

     

    Thanks for the help.

  4. Thanks for the reply.

     

    Actually, I'm looking for a way to display messages that are read from an IMAP server, without needing to dismantle/store the various parts in a database.  Just read and display, like any ol' webmail.  I tried looking at the code for a few apps like SquirrelMail, but couldn't make heads or tails of it.  It's pretty complex.  I just want to do something very very simple, so I can understand how it works.

  5. If I simply output the file using readfile() or something like it, how does the web browser know that the data is for use as the cid:blahblah image?  I know I could use header() to add "Content-Type" image/whateveritis", "Content-Disposition: inline", etc., but what should I use in the "filename" parameter of "Content-Disposition"?  Would it be the actual name of the file, or the ID parameter, which is referenced in the HTML code (<img src="cid:blahblah">)?

     

    Thanks, hope someone can help.  Much appreciated!

     

    JEff

  6.  

    Hello,

     

    I am attempting to understand PHP's email functions and writing my own simple mail display script.  I have so far been able to snag the HTML part of email messages, but I'm having trouble with inline images contained in a message.  I can figure out which body part contains the image, and I can load the data from the message into a variable, decoding/converting as need be.  What I can't figure out, though, is how to get the image to display in the browser when I echo the HTML message body. 

     

    Here's the way I've been approaching the problem thus far:

     

    1. Use imap_fetchstructure to get info on a message.

    2. Analyze the parts to find body part numbers for the HTML and the image(s).

    3. Echo the HTML to the browser.

     

    The HTML sent to the browser contains <img src="cid:bunchanumbers">.  How do I get the image to show up in that spot?

     

    Thanks muchos,

     

    Jeff

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.