PowWeb Forums - The Perfect Community for the Perfect Host  

Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more.

Go Back   PowWeb Community Forums > The PowWeb Platform > PHP
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Closed Thread
 
Thread Tools
Old 12-15-05, 10:34 AM   #1
kurniawan
 
kurniawan's Avatar
 
Join Date: Feb 2005
Location: Biringkanaya
Posts: 306
Reputation: 43
To understand script

Currently I am using one of B&T scripts, I like it very much because it is simple and most of all it works great
I am just curious to understand what is the meaning of
$headerArray[0] = $mailheader->subject;
$from = $mailheader->from;
from the script below, could anybody share knowledge? I am totally blank

PHP Code:
function getHeader($msgStream$msgNumber) {
  
$mailheader imap_headerinfo($msgStream$msgNumber);
  
$headerArray = array();
  
$headerArray[0] = $mailheader->subject;
  
$from $mailheader->from;
  foreach (
$from as $id => $object) {
    
$headerArray[1]  = $object->personal;  // from personal
    
$headerArray[2]  = $object->mailbox "@" $object->host;  // from address
  
}
  
$headerArray[3] = $mailheader->Date;
  return 
$headerArray;

Thanks before.
kurniawan is offline  
Old 12-15-05, 11:48 AM   #2
mitchind
Older not wiser
 
mitchind's Avatar
 
Join Date: Nov 2003
Location: Calgary, AB
Posts: 2,472
Reputation: 205
PHP Manual info for imap-headerinfo

http://php.mirrors.ilisys.com.au/man...headerinfo.php
mitchind is offline  
Old 12-17-05, 11:20 AM   #3
kurniawan
 
kurniawan's Avatar
 
Join Date: Feb 2005
Location: Biringkanaya
Posts: 306
Reputation: 43
Mitchind,
I've tried to learn the link you give me, but dummy me I couldn't get what I want. I simply want the message content excluding the code like

Code:
--0-1538132792-1134666428=:3145 Content-Type: text/plain; charset=iso-2022-jp
I've spent hours, but still no result If I simply replace the lines that coming with the message content, when I try to send from another mail provider, as you can imagine, the lines are diferent. Can you help me?
kurniawan is offline  
Old 12-19-05, 11:31 AM   #4
kurniawan
 
kurniawan's Avatar
 
Join Date: Feb 2005
Location: Biringkanaya
Posts: 306
Reputation: 43
Anybody familiar with knowledge about how php reads mail? I have been reading the documentation, but can't understand. I simply want the script to extract the mail and get body only without any other headers.
kurniawan is offline  
Old 12-19-05, 11:40 AM   #5
mitchind
Older not wiser
 
mitchind's Avatar
 
Join Date: Nov 2003
Location: Calgary, AB
Posts: 2,472
Reputation: 205
Try:
Quote:
string imap_body (int imap_stream, int msg_number [, int flags])


imap_body() returns the body of the message, numbered msg_number in the current mailbox. The optional flags are a bit mask with one or more of the following:


FT_UID - The msgno is a UID

FT_PEEK - Do not set the \Seen flag if not already set

FT_INTERNAL - The return string is in internal format, will not canonicalize to CRLF.


imap_body() will only return a verbatim copy of the message body. To extract single parts of a multipart MIME-encoded message you have to use imap_fetchstructure() to analyze its structure and imap_fetchbody() to extract a copy of a single body component.
mitchind is offline  
Old 12-19-05, 12:33 PM   #6
kurniawan
 
kurniawan's Avatar
 
Join Date: Feb 2005
Location: Biringkanaya
Posts: 306
Reputation: 43
Thank you, although I didn't understand the above instruction I finally found other way, I used

$body=imap_fetchbody($msgStream,$msgNumber,1);

But my other problem is, whole emails are being read by mail server and it converts all japanese characters into ASCII code. Anything I can do to get the original contents? How can I set my email server to receive characters like japanese?

Thank you for your time.
kurniawan is offline  
Old 12-21-05, 11:05 AM   #7
kurniawan
 
kurniawan's Avatar
 
Join Date: Feb 2005
Location: Biringkanaya
Posts: 306
Reputation: 43
I did it! I use iconv function to convert the text into UTF and it shows the character I wanted.

Thank you for looking at this posting.
kurniawan is offline  
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:30 AM.


Contents ©PowWeb, Inc. ~ vBulletin, Copyright © 2000-2007 Jelsoft Enterprises Limited.