public static function PostmarkHandler::checkApiSettings in Postmark 8
Check if API settings are correct and not empty.
2 calls to PostmarkHandler::checkApiSettings()
- PostmarkHandler::sendMail in src/
PostmarkHandler.php - Connects to Postmark API and sends out the email.
- postmark_requirements in ./
postmark.install - Implements hook_requirements().
File
- src/
PostmarkHandler.php, line 162
Class
- PostmarkHandler
- Mail handler to send out an email message array to the Postmark API.
Namespace
Drupal\postmarkCode
public static function checkApiSettings($key, $signature, $showMessage = FALSE) {
if (empty($key) || empty($signature)) {
if ($showMessage) {
\Drupal::messenger()
->addWarning(t('Please check your Postmark settings. API token and Sender Signature must not be empty.'));
}
return FALSE;
}
if (self::validateKey($key) === FALSE) {
if ($showMessage) {
\Drupal::messenger()
->addWarning(t('Unable to connect to the Postmark API. Please check your API settings.'));
}
return FALSE;
}
return TRUE;
}