/**
  * Save the email in the monograph email log.
  */
 function log()
 {
     import('classes.monograph.log.MonographEmailLogEntry');
     import('classes.monograph.log.MonographLog');
     $entry = new MonographEmailLogEntry();
     $monograph =& $this->monograph;
     // Log data
     $entry->setEventType($this->eventType);
     $entry->setAssocType($this->assocType);
     $entry->setAssocId($this->assocId);
     // Email data
     $entry->setSubject($this->getSubject());
     $entry->setBody($this->getBody());
     $entry->setFrom($this->getFromString(false));
     $entry->setRecipients($this->getRecipientString());
     $entry->setCcs($this->getCcString());
     $entry->setBccs($this->getBccString());
     // Add log entry
     $logEntryId = MonographLog::logEmailEntry($monograph->getId(), $entry);
     // Add attachments
     import('classes.file.MonographFileManager');
     foreach ($this->getAttachmentFiles() as $attachment) {
         MonographFileManager::temporaryFileToMonographFile($monograph->getId(), $attachment, MONOGRAPH_FILE_ATTACHMENT, $logEntryId, ASSOC_TYPE_MONOGRAPH_EMAIL_LOG_ENTRY);
     }
 }