submit note
| From: | DokFLeed.Net | Date: | Sun, 26 Jan 2003 16:48:26 +0000 |
| Subject: | submit note | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-15332@lists.php.net to get a copy of this message | ||
Hello , i tried to submit a note for
http://www.php.net/manual/add-note.php?sect=function.imap-header&redirect=http://www.php.net/manual/en/function.imap-header.php
and i always get this error , though its manually wrapped and tried on notepad
Your note contains a bit of text that will result in a line that is too long, even after using
wordwrap().
anyway here is the note since i dont know if itis posted or not , and i think it will be usefull to
others
DokFLeed dokfleed at dokfleed dot com
26-Jan-2003 11:28
After getting lost for days,i gathered all what i could find plus
the codes i tweaked according to the manual , here they go,
all formatted and ready to use ,
this will grab all the messages in a mail box, and read them.
You will need to replace Username & Password by yours, ( i
dont know what the "adl" or why isnt it showing ( codes i
gathered , their credits goes to whoever they belong)
==============================
Start of Code
==============================
//It opens up an IMAP connection to the mailserver specified
//by $MAILSERVER, passing in your username and password.
//It then get a list of all the messgae headers and in a loop,
//prints them all out. Besides printing them out, click the link
//to read it , passing the message number to the function
//viewmailz
function readmailz(){
$MAILSERVER="{mail.host.com:143}"; or $MAILSERVER="{localhost:143}";
$PHP_AUTH_USER = "USERNAME";
$PHP_AUTH_PW = "PASSWORD";
$mbox=imap_open($MAILSERVER,$PHP_AUTH_USER,$PHP_AUTH_PW);
echo "Number of Total Emails: ".imap_num_msg($mbox);
echo " Number of Recent Emails:
".imap_num_recent($mbox)."<BR><BR>";
$headers=imap_headers($mbox);
for($x=0; $x < count($headers); $x++) {
$idx=($x+1);
echo $idx." <a
href=\"$PHP_SELF?num=$idx\">$headers[$x]</a><br>";
}
imap_close($mbox);
}
//viewmailz opens up the IMAP connection the same as
// above, and gets the mail message's header information and
//prints it out.
//It then reads in the body of the mail message and prints
//that out to the screen.
function viewmailz($num){
$MAILSERVER="{mail.host.com:143}"; or $MAILSERVER="{localhost:143}";
$PHP_AUTH_USER = "USERNAME";
$PHP_AUTH_PW = "PASSWORD";
$mbox=imap_open($MAILSERVER,$PHP_AUTH_USER,$PHP_AUTH_PW);
$header=imap_headerinfo($mbox,$num,80,80);
$from = $header->from;
$udate=$header->udate;
$date=Date("F j, Y, g:i a", $udate);
echo "Message Number: ". $num."<br>";
$subject= $header->fetchsubject;
if (is_array($from)){
while(list($key, $val) = each($from)) {
echo "From Address: ";
echo
$fromaddr=sprintf("%s@%s",$from[0]->mailbox,$from[0]->host)."<BR>";
echo "Personal : ".$from[0]->personal."<br>";
echo "Adl : ".$from[0]->adl."<br>";
echo "Mailbox : ".$from[0]->mailbox."<br>";
echo "Host : ".$from[0]->host."<br>";
echo "Subject : ".$subject."<br>";
echo "Date : ".$date."<br>";
echo "To Address : ".$header->toaddress."<br><BR><BR>";
}
}
echo imap_body($mbox,$num)."<br>END OF BODY<br>";
imap_close($mbox);
}
==========================
END OF Code
==========================