protected function SendGridMail::isValidContentType in SendGrid Integration 8.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 SendGridMail::isValidContentType()
- SendGridMail::getAttachmentStruct in src/Plugin/ Mail/ SendGridMail.php 
- Return an array structure for a message attachment.
File
- src/Plugin/ Mail/ SendGridMail.php, line 787 
- Implements Drupal MailSystemInterface.
Class
- SendGridMail
- @file Implements Drupal MailSystemInterface.
Namespace
Drupal\sendgrid_integration\Plugin\MailCode
protected function isValidContentType(string $file_type) : bool {
  $valid_types = [
    'image/',
    'text/',
    'application/pdf',
    'application/x-zip',
  ];
  // Allow modules to alter the valid types array.
  \Drupal::moduleHandler()
    ->alter('sendgrid_integration_valid_attachment_types', $valid_types);
  foreach ($valid_types as $vct) {
    if (strpos($file_type, $vct) !== FALSE) {
      return TRUE;
    }
  }
  return FALSE;
}