"; $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8\r\n" . $headers; if ( !mail( $row['Email'], $row['Subj'], $row['Body'], $headers, "-f{$site['email_notify']}") ) ++$err; if ( $row[ID1] && $row[ID2] ) db_res("DELETE FROM NotifyQueue WHERE `Email` = $row[ID1] AND `Msg` = $row[ID2] AND `From` = 'NotifyEmails'", 0 ); else echo "ERROR: while deleting from 'NotifyQueue' ( Email ID: $row[ID1], Msg ID: $row[ID2] )\n"; ++$count_ok; if ( $count_ok >= $total_count ) break; } } if ( $count_ok < $total_count ) { // Profiles Messages $nfs_res = db_res(" SELECT NotifyQueue.Email as ID1, NotifyQueue.Msg as ID2, Profiles.NickName as Name, Profiles.Email, NotifyMsgs.Subj, NotifyMsgs.HTML as Body FROM NotifyQueue INNER JOIN NotifyMsgs ON (NotifyMsgs.ID = NotifyQueue.Msg) INNER JOIN Profiles ON (Profiles.ID = NotifyQueue.Email) WHERE NotifyQueue.`From` = 'Profiles' AND Profiles.EmailNotify = 'NotifyMe' ",0 ); while( $row = mysql_fetch_array( $nfs_res ) ) { $headers = "From: {$site['title']} <{$site['email_notify']}>"; $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8\r\n" . $headers; if ( !mail( $row['Email'], $row['Subj'], $row['Body'], $headers, "-f{$site['email_notify']}") ) ++$err; if ( $row[ID1] && $row[ID2] ) db_res("DELETE FROM NotifyQueue WHERE Email = $row[ID1] AND Msg = $row[ID2] AND NotifyQueue.`From` = 'Profiles'", 0 ); else echo "ERROR: while deleting from 'NotifyQueue' ( Email ID: $row[ID1], Msg ID: $row[ID2] )\n"; ++$count_ok; if ( $count_ok >= $total_count ) break; } } if ( $count_ok < $total_count ) { // Profiles Messages $nfs_res = db_res(" SELECT NotifyQueue.Email as ID1, NotifyQueue.Msg as ID2, NotifyQueue.MsgText as Body, NotifyQueue.MsgSubj as Subj, Profiles.NickName as Name, Profiles.Email FROM NotifyQueue INNER JOIN Profiles ON (Profiles.ID = NotifyQueue.Email) WHERE NotifyQueue.`From` = 'ProfilesMsgText' AND Profiles.EmailNotify = 'NotifyMe' ",0); while( $row = mysql_fetch_array( $nfs_res ) ) { $body = $row['Body']; $headers = "From: {$site['title']} <{$site['email_notify']}>"; $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8\r\n" . $headers; if ( !mail( $row['Email'], $row['Subj'], $body, $headers, "-f{$site['email_notify']}") ) ++$err; if ( !db_res("DELETE FROM NotifyQueue WHERE Email = $row[ID1] AND NotifyQueue.`From` = 'ProfilesMsgText'", 0 ) ) echo "ERROR: while deleting from 'NotifyQueue' ( Email ID: $row[ID1], Msg ID: $row[ID2] )\n"; ++$count_ok; if ( $count_ok >= $total_count ) break; } } echo "Processed emails: $count_ok\n"; echo "Processed emails with errors: $err\n"; } if( $err and $MODE == '_MAIL_' ) { $output = ob_get_clean(); mail( $site['email'], "{$site['title']}: Periodic Report (Notify Letters)", $output, "From: Periodic(Notify Letters) <$site[email]>", "-f$site[email]" ); } periodic_check_ban();