protected function EmailWebformHandler::supportsAttachments in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformHandler/EmailWebformHandler.php \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::supportsAttachments()
Check that emailing files as attachments is supported.
Return value
bool TRUE if emailing files as attachments is supported.
2 calls to EmailWebformHandler::supportsAttachments()
- EmailWebformHandler::buildConfigurationForm in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Form constructor.
- EmailWebformHandler::getMessageAttachments in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Get message file attachments.
File
- src/
Plugin/ WebformHandler/ EmailWebformHandler.php, line 1349
Class
- EmailWebformHandler
- Emails a webform submission.
Namespace
Drupal\webform\Plugin\WebformHandlerCode
protected function supportsAttachments() {
// If 'system.mail.interface.default' is 'test_mail_collector'
// allow email attachments during testing.
if ($this->configFactory
->get('system.mail')
->get('interface.default') === 'test_mail_collector') {
return TRUE;
}
// If webform_test.module is installed and this is a test webform
// allow email attachments.
if (strpos($this
->getWebform()
->id(), 'test_') === 0 && $this->moduleHandler
->moduleExists('webform_test')) {
return TRUE;
}
// The Mail System module, which supports a variety of mail handlers,
// and the SMTP module support attachments.
$mailsystem_installed = $this->moduleHandler
->moduleExists('mailsystem');
$smtp_enabled = $this->moduleHandler
->moduleExists('smtp') && $this->configFactory
->get('smtp.settings')
->get('smtp_on');
return $mailsystem_installed || $smtp_enabled;
}