$str = "{".$host."/".$protocol.":".$port."}INBOX"; imap_open($str, "$user", "$password"); try this...