Hey guru's,
I started programming a script today to retreive email from a POP3 server. I am using the example that is on this site. However I am using PHP5 and getting it to connect to a pop3 server instead of imap..
Here is my code;
1st page;
$MAILSERVER="{mail.cs-ms.com/pop3}";
$link=imap_open($MAILSERVER,'postmaster@cs-ms.com','password');
$headers=imap_headers($link);
for($x=1; $x < count($headers); $x++) {
$idx=($x-1);
echo "<a href=\"view.php?num=$x\">$headers[$idx]</a><br>";
}
View the mail page;
$MAILSERVER="{mail.cs-ms.com/pop3}";
$link=imap_open($MAILSERVER,'postmaster@cs-ms.com','password');
$header=imap_header($link,$_GET[num]);
echo "From: $header[fromaddress]<br>";
echo "To: $header[toaddress]<br>";
echo "Date: $header[Date]<br>";
echo "Subject: $header[Subject]<br><br>";
echo imap_body($link,$num);
Ok the error I get on this page is;
Fatal error: Cannot use object of type stdClass as array in D:\www\cs-ms\plugins\xm_sms\view.php on line 6
Can anyone tell me what I am doing wrong?
FYI - The first page works fine, the mails get listed, it's only when trying to access the header array on the second page that it freaks out.
Thanks in advance.
Sn0rcha
*Update
I changed it to try using "imap" instead of "pop" with the same error!
Any ideas? Is that tutorial wrong for php5?