/** * This function handles determining the protocol and fetching the mail * @return array */ function FetchMail($server = NULL, $port = NULL, $email = NULL, $password = NULL, $protocol = NULL, $offset = NULL, $test = NULL, $deleteMessages = true) { $emails = array(); if (!$server || !$port || !$email) { die("Missing Configuration For Mail Server\n"); } if ($server == "pop.gmail.com") { print "\nMAKE SURE POP IS TURNED ON IN SETTING AT Gmail\n"; } switch (strtolower($protocol)) { case 'smtp': //direct $fd = fopen("php://stdin", "r"); $input = ""; while (!feof($fd)) { $input .= fread($fd, 1024); } fclose($fd); $emails[0] = $input; break; case 'imap': case 'imap-ssl': case 'pop3-ssl': HasIMAPSupport(false); if ($test) { $emails = TestIMAPMessageFetch(); } else { $emails = IMAPMessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages); } break; case 'pop3': default: if ($test) { $emails = TestPOP3MessageFetch(); } else { $emails = POP3MessageFetch($server, $port, $email, $password, $protocol, $offset, $test, $deleteMessages); } } if (!$emails) { //die("\n" . __('There does not seem to be any new mail.', 'postie') . "\n"); $emails = false; } return $emails; }
/** * This function handles determining the protocol and fetching the mail * @return array */ function FetchMail() { $config = GetConfig(); $emails = array(); if (!$config["MAIL_SERVER"] || !$config["MAIL_SERVER_PORT"] || !$config["MAIL_USERID"]) { die("Missing Configuration For Mail Server\n"); } if ($config["MAIL_SERVER"] == "pop.gmail.com") { print "\nMAKE SURE POP IS TURNED ON IN SETTING AT Gmail\n"; } switch (strtolower($config["INPUT_PROTOCOL"])) { case 'smtp': //direct $fd = fopen("php://stdin", "r"); $input = ""; while (!feof($fd)) { $input .= fread($fd, 1024); } fclose($fd); $emails[0] = $input; break; case 'imap': case 'imap-ssl': case 'pop3-ssl': HasIMAPSupport(false); if ($config["TEST_EMAIL"]) { $emails = TestIMAPMessageFetch(); } else { $emails = IMAPMessageFetch(); } break; case 'pop3': default: if ($config["TEST_EMAIL"]) { $emails = TestPOP3MessageFetch(); } else { $emails = POP3MessageFetch(); } } if (!$emails) { die("\nThere does not seem to be any new mail.\n"); } return $emails; }