Been haveing problems with POP authentication in PHP. Since my server requres pop first, I conected and loged into pop first, that worked great, while conected I now try to send my mail through SMTP. What I think the problem might be is the conection is a new one with mail() and doesnt remember im still logged into pop? I checked out the code library and downloaded a few scripts from the network section for mail, but am unable to find a way to do this. Can someone give me some ideas?
$fp = fsockopen("127.0.0.1", 110);
$msg = fgets($fp,150);
fputs($fp, "USER journy101\n");
$msg = fgets($fp,150);
fputs($fp, "PASS xxxxxx\n");
$msg = fgets($fp,150);
$msg = "This is a test.";
$headers = "From: anon <anon@hotmail.com>\r\n";
$headers .= "To: anon <anon@hotmail.com>\r\n";
mail("anon@hotmail.com","Testing",$msg,$headers);
fputs($fp, "QUIT\n");
fclose($fp);
Requested POP3 connection from 127.0.0.1
+OK ArGoSoft Mail Server Freeware, Version 1.8 (1.8.3.4)
USER journy101
+OK Password required for journy101
PASS XXXXXX
+OK Mailbox locked and ready
Requested SMTP connection from 127.0.0.1
220 ArGoSoft Mail Server Freeware, Version 1.8 (1.8.3.4)
HELO anon
250 Welcome [127.0.0.1], pleased to meet you
MAIL FROM:<journy101@localhost>
250 Sender "journy101@localhost" OK...
RCPT TO:<anon@hotmail.com>
550 User not local. Authentication required for relay
QUIT
221 Aba he
QUIT
SMTP connection with 127.0.0.1 ended. ID=2
+OK Aba he
POP3 connection with 127.0.0.1 ended. ID=1