public function interimAttachmentCheck(\splFileInfo $attachment, \CentralApps\Mail\Message $message) { $errors = array(); $preexisting_attatchments = $message->getAttachments(); $existing_size = $this->getAttachmentsSize($preexisting_attatchments); if ($attachment->getSize() + $existing_size > $this->maxAttachmentSize) { $errors[] = "Attachments too large, you have exceeded the attachment size limit for PostMarkApp"; } if (count($preexisting_attatchments) + 1 > $this->maxNumAttachments) { $errors[] = "Too many attachments. Postmark app only permits " . $this->maxNumAttachments . " attachments per message"; } if (!$this->attachmentCheckFileTypes($attachment)) { $errors[] = "The attachment " . $attachment->getFilename() . " is not permitted to be sent via PostMarkApp"; } return $errors; }
public function getMetricFromFile(\splFileInfo $file) { return $file->getSize(); }