3 define('FULLME','cron'); // prevent warnings
5 //ini_set('display_errors',0);
6 require_once(dirname(dirname(__FILE__
)).'/config.php');
7 $tmp = explode('@',$_ENV['RECIPIENT']);
10 // BOUNCE EMAILS TO NOREPLY
11 if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress
) {
12 $user->email
= $_ENV['SENDER'];
14 if (!validate_email($user->email
)) {
19 $subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname
));
20 $body = get_string('noreplybouncemessage','moodle',format_string($site->fullname
))."\n\n";
22 $fd = fopen('php://stdin','r');
30 $user->id
= 0; // to prevent anything annoying happening
32 $from->firstname
= null;
33 $from->lastname
= null;
35 $from->maildisplay
= true;
37 email_to_user($user,$from,$subject,$body);
40 /// ALL OTHER PROCESSING
41 // we need to split up the address
42 $prefix = substr($address,0,4);
43 $mod = substr($address,4,2);
44 $modargs = substr($address,6,-16);
45 $hash = substr($address,-16);
47 if (substr(md5($prefix.$mod.$modargs.$CFG->siteidentifier
),0,16) != $hash) {
48 die("HASH DIDN'T MATCH!\n");
50 list(,$modid) = unpack('C',base64_decode($mod.'=='));
52 if ($modid == '0') { // special
56 $modname = get_field("modules","name","id",$modid);
57 require_once('mod/'.$modname.'/lib.php');
59 $function = $modname.'_process_email';
61 if (!function_exists($function)) {
64 $fd = fopen('php://stdin','r');
73 $function($modargs,$body);