示例#1
0
 /**
  * Validate that notification email retrieval removes improperly formatted email addresses
  */
 public function test_getnoficiationemailsremovesinvalidemails()
 {
     set_config('emailnotification', 'user1@domain1.com,bogus,user2@domain2.com', 'dhimport_version1');
     $emails = rlip_get_notification_emails('dhimport_version1');
     $expectedresult = array('*****@*****.**', '*****@*****.**');
     $this->assertEquals($emails, $expectedresult);
 }
示例#2
0
文件: lib.php 项目: jamesmcq/elis
/**
 * Send log emails to all appropriate users for one plugin run
 *
 * @param string $plugin The plugin for which we are sending logs
 * @param array $logids The list of database record ids pointing to log files
 * @param boolean $manual True if manual, false if scheduled
 */
function rlip_send_log_emails($plugin, $logids, $manual = false)
{
    global $CFG;
    //obtain the sanitized list of emails
    $emails = rlip_get_notification_emails($plugin);
    //create the zip file
    $archive_name = rlip_compress_logs_email($plugin, $logids, $manual);
    if ($archive_name === false) {
        //no logs to send
        return false;
    }
    //send to all appropriate users
    foreach ($emails as $email) {
        $recipient = rlip_get_email_recipient($email);
        rlip_send_log_email($plugin, $recipient, $archive_name);
    }
    @unlink($CFG->dataroot . '/' . $archive_name);
    return true;
}