Having problems with IMAP extension

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
$0.05$
Forum Newbie
Posts: 5
Joined: Fri Sep 27, 2002 10:54 pm
Location: Canada
Contact:

Having problems with IMAP extension

Post 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?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

shouldn't imap_open be like this:
imap_open("{".$mailserver.":".$port."/pop3}", $username, $password);
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Code: Select all

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