Example #1
0
 function savemsg($args)
 {
     # Get a new message number to append too
     $id = $this->get_spare_msg($args['Account'], $args['EmailBox']);
     $filename = $this->escape_pathname("{$pref['user_dir']}/users/{$args['Account']}/mbox/{$args['EmailBox']}/{$id}.msg");
     # Create a new file and print the message
     $fh = fopen("{$filename}", 'w') || Config::catcherror("Error cannot open {$filename}");
     fwrite($fh, "From atmail " . localtime() . "\n");
     if ($args['EmailFile']) {
         $msq = file_get_contents($args['EmailFile']);
         fwrite($fh, $msq);
     } else {
         fwrite($fh, $args['EmailMessage']);
     }
     fclose($fh);
     return;
 }