Results 1 to 4 of 4

Thread: [RESOLVED] Receiving email issues

  1. #1

    Thread Starter
    Hyperactive Member boku's Avatar
    Join Date
    Dec 2004
    Posts
    386

    Resolved [RESOLVED] Receiving email issues

    This is my code.

    PHP Code:
    $message imap_fetchbody($inbox$email_number1.2);
                            if (
    $message == "") {
                                
    $message imap_fetchbody($inbox$email_number1.1);
                            }
                            if (
    $message == "") {
                                
    $message imap_fetchbody($inbox$email_number1);
                            }
                    
    $FindHashes stripos($message"####");
                    
    $StaffMessage = (substr($message,0,$FindHashes))."</body></html>";
                    
    $StaffMessage quoted_printable_decode($StaffMessage);
                    
    $StaffMessage htmlspecialchars($StaffMessageENT_QUOTES); 
    Yes it may look a bit untidy, but that is not the problem. The problem I'm having is that if the email (sent from outlook '07) does not have an attachment I don't get anything but a nasty looking plain text email. If I do have an attachment on the email then I get lovely colored formatted email.

    FYI I am decoding the htmlspecialchars before I display them.

    How do I get a nice email if there is nothing attached?

    Thanks in advance
    -BoKu-

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Receiving email issues

    check the entire value of $message after it's returned from imap_fetchbody():
    PHP Code:
    echo '<xmp>' $message '</xmp>'
    if you have no attachments, part 1 will contain the message body -- but make sure you're getting what you're expecting.

    you might want to take a look at this comment on PHP.net, too.

  3. #3

    Thread Starter
    Hyperactive Member boku's Avatar
    Join Date
    Dec 2004
    Posts
    386

    Re: Receiving email issues

    Do you mean using this to get the entire?

    PHP Code:
    imap_fetchbody($inbox$email_number0
    -BoKu-

  4. #4

    Thread Starter
    Hyperactive Member boku's Avatar
    Join Date
    Dec 2004
    Posts
    386

    Re: Receiving email issues

    SOLVED IT!

    Basically (Thanks to Kow) I discovered I was reading the wrong parts based on content, using this script I discovered the best ones to use.

    PHP Code:
                    print "<p><h1>1</h1>".quoted_printable_decode(imap_fetchbody($inbox$email_number0FT_PEEK))."</p><hr>";
                    print 
    "<p><h1>2</h1>".quoted_printable_decode(imap_fetchbody($inbox$email_number1FT_PEEK))."</p><hr>";
                    print 
    "<p><h1>3</h1>".quoted_printable_decode(imap_fetchbody($inbox$email_number1.1FT_PEEK))."</p><hr>";
                    print 
    "<p><h1>4</h1>".quoted_printable_decode(imap_fetchbody($inbox$email_number1.2FT_PEEK))."</p><hr>";
                    print 
    "<p><h1>5</h1>".quoted_printable_decode(imap_fetchbody($inbox$email_number2FT_PEEK))."</p><hr>"
    -BoKu-

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width