Page 1 of 1

Having problems with IMAP extension

Posted: Fri Sep 27, 2002 10:54 pm
by $0.05$
here is my code:

Code: Select all

<?php

	$mailserver = "pop server";
	$port		= "110";
	$username	= "user";
	$password	= "password";
	
	$mail   = imap_open("{".$mailserver."/pop3:".$port."}", $username, $password);
	$number = imap_num_msg($mail); 
	$x=1;

	while ($x <= $number){
	
	$body = imap_body($mail, $x);
	$head = imap_header($mail, $x);
	
	if(!isset($head->Subject)) {
		$header->Subject = "No Subject";
	}
	
	print $head->Subject;
	print $head->fromaddress;
	print $body;
	$x=$x+1;
	}

?>
now, the problem that im having, is that i am getting nothing from the imap_header function. The objects it returns seem to be null. When i attempt to print $head->Subject; i get nothing, when i try to print $head->fromaddress; i get nothing, but when i print body, i get the whole body. Can someone please point me in the right direction??!

Maybe another way to connect to a pop server?

Posted: Fri Sep 27, 2002 11:12 pm
by mydimension
shouldn't imap_open be like this:
imap_open("{".$mailserver.":".$port."/pop3}", $username, $password);

Posted: Sat Sep 28, 2002 12:26 pm
by Takuma

Code: Select all

<?php
imap_open("{".$mailserver.":".$port."/pop3}INBOX", $username, $password);
?>