Hi again,
Also how do I output on the php page the email
addresses it collects from the email body?
echo "Email was" . $email . " ";
appears to return nothing...
Thanks!
<?php
include("../db/connectionstart.php");
global $IP_RegExp_Match, $Host_RegExp_Match,
$Email_RegExp_Match;
$IP_RegExp_Match =
'\\[?[0-9]{1,3}(\\.[0-9]{1,3}){3}\\]?';
$Host_RegExp_Match = '(' . $IP_RegExp_Match .
'|[0-9a-z]([-.]?[0-9a-z])*\\.[a-z][a-z]+)';
$Email_RegExp_Match = '[0-9a-z]([-_.+]?[0-9a-z])*(%'
. $Host_RegExp_Match .
')?@' . $Host_RegExp_Match;
$user = 'whatever';
$pass = 'whenever';
$MAILSERVER="{mail.yourpop3servergoeshere.com:110/pop3/notls}";
//Para POP3
$mbox = @imap_open ($MAILSERVER,$user,$pass) or die
("Sorry can't connect -
please check your settings");
$check = imap_mailboxmsginfo($mbox);
echo "Messages before delete: " . $check->Nmsgs .
"<br />\n";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "There are no messages to be deleted.<br
/>\n";
} else {
while (list ($key, $val) = each ($headers)) {
for ($i = 1; $i <= imap_num_msg($mbox); $i++)
{
$header = imap_headerinfo($mbox, $i, 80, 80);
$messageBody = imap_body($mbox, $i);
$messageBody = strip_tags($messageBody,
'<a><b><i><u>');
$messageBody = str_replace("\'", "", $messageBody);
$messageBody = str_replace("\\", "", $messageBody);
$messageBody = str_replace("\"", "", $messageBody);
$messageBody = str_replace("3D", "", $messageBody);
global $color, $Email_RegExp_Match;
$sbody = $messageBody;
$addresses = array();
/* Find all the email addresses in the body */
while(eregi($Email_RegExp_Match, $sbody, $regs))
{
$addresses[$regs[0]] = $regs[0];
$start = strpos($sbody, $regs[0]) +
strlen($regs[0]);
$sbody = substr($sbody, $start);
}
/* Replace each email address with a compose URL
*/
foreach ($addresses as $email) {
$body = str_replace($email, $comp_uri,
$body);
mysql_query ("DELETE FROM emaillist WHERE EMail =
'$email'");
};
imap_delete($mbox, 1);
$check = imap_mailboxmsginfo($mbox);
imap_expunge($mbox);
$check = imap_mailboxmsginfo($mbox);
};
}};
$check = imap_mailboxmsginfo($mbox);
echo "Messages after delete: " . $check->Nmsgs .
"<br />\n";
imap_close($mbox);
?>
http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php