} if ($format == 'txt') { /** * The 'false' here means that the html or text is not embedded * so nessquik will not strip off the HTML,HEAD,BODY etc tags, * and will not replace newline (\n) chars in the text format * with <br> tags */ $output = $nes->output_text($content, false); $ext = 'txt'; } elseif ($format == 'html') { $output = $nes->output_html($content, false); $ext = 'html'; } else { if ($format == 'nbe') { $output = $nes->output_nbe($content, false); $ext = 'nbe'; } } /** * The empty field is the alternate recipients list. * The $ext value in the function call will work fine as long * as I dont changet the 'html' string above because that * is how the send_email function determines if it should * send HTML mail or text mail */ send_email($email, '', "Nessus Scan Results", $output, $ext); echo "pass"; break; case "x_cancel_scan_profile": $profile_id = import_var('profile_id', 'P');
$subject = str_replace("%m", $machine_list[0] . ' and ' . $machine_list[1], $subject); } else { $subject = str_replace("%m", $machine_list[0], $subject); } $subject = str_replace("%D", $start_date, $subject); $subject = str_replace("%d", $end_date, $subject); $subject = str_replace("%T", $start_time, $subject); $subject = str_replace("%t", $end_time, $subject); if ($format == 'txt') { $output = $nes->output_text($output); } else { if ($format == 'html') { $output = $nes->output_html($output); } else { if ($format == 'nbe') { $output = $nes->output_nbe($output); } } } if (_DEBUG) { fwrite($dfh, "\nEmailing scan results"); } // If there are multiple recipients, then they need to have email sent to them if (count($recipients) > 0) { if (!$client->query('jobs.emailResults', _CLIENT_KEY, $profile_id, $recipients, $subject, $output, $format)) { die($client->getErrorCode() . ' : ' . $client->getErrorMessage()); } } else { if (!$client->query('jobs.emailResults', _CLIENT_KEY, $profile_id, '', $subject, $output, $format)) { die($client->getErrorCode() . ' : ' . $client->getErrorMessage()); }