You are here

protected function MandrillMailSystem::isValidContentType in Mandrill 7.2

Helper to determine if an attachment is valid.

Parameters

string $file_type: The file mime type.

Return value

bool True or false.

1 call to MandrillMailSystem::isValidContentType()
MandrillMailSystem::getAttachmentStruct in lib/mandrill.mail.inc
Return an array structure for a message attachment.

File

lib/mandrill.mail.inc, line 276
Implements Mandrill as a Drupal MailSystemInterface

Class

MandrillMailSystem
Modify the drupal mail system to use Mandrill when sending emails.

Code

protected function isValidContentType($file_type) {
  $valid_types = array(
    'image/',
    'text/',
    'application/pdf',
    'application/x-zip',
  );
  drupal_alter('mandrill_valid_attachment_types', $valid_types);
  foreach ($valid_types as $vct) {
    if (strpos($file_type, $vct) !== FALSE) {
      return TRUE;
    }
  }
  return FALSE;
}