You are here

protected function SparkpostMailSystem::isValidContentType in Sparkpost email 7.2

Same name and namespace in other branches
  1. 7 includes/sparkpost.mail.inc \SparkpostMailSystem::isValidContentType()

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 SparkpostMailSystem::isValidContentType()
SparkpostMailSystem::getAttachmentStruct in includes/sparkpost.mail.inc
Return an array structure for a message attachment.

File

includes/sparkpost.mail.inc, line 210
Implements Sparkpost as a Drupal MailSystemInterface

Class

SparkpostMailSystem
Modify the drupal mail system to use Sparkpost when sending emails.

Code

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