function sendgrid_integration_test in SendGrid Integration 7
Same name and namespace in other branches
- 8.2 sendgrid_integration.admin.inc \sendgrid_integration_test()
- 8 sendgrid_integration.admin.inc \sendgrid_integration_test()
Provides a form to send a test email through Sendgrid.
1 string reference to 'sendgrid_integration_test'
- sendgrid_integration_menu in ./
sendgrid_integration.module - Implements hook_menu().
File
- ./
sendgrid_integration.admin.inc, line 113
Code
function sendgrid_integration_test() {
$form = [];
$defaults = variable_get('sendgrid_integration_test_defaults', [
'to' => variable_get('site_mail', 'user@example.com'),
'subject' => 'Test Email from SendGrid Module',
'body' => [
'value' => 'Test Message for SendGrid.',
],
'fromname' => '',
'toname' => '',
'replyto' => '',
]);
$defaults['body']['format'] = filter_fallback_format();
$form['fromname'] = [
'#type' => 'textfield',
'#title' => t('From name'),
'#default_value' => isset($defaults['fromname']) ? $defaults['fromname'] : '',
'#maxlength' => 128,
];
$form['to'] = [
'#type' => 'textfield',
'#title' => t('To'),
'#default_value' => $defaults['to'],
'#maxlength' => 128,
'#required' => TRUE,
];
$form['toname'] = [
'#type' => 'textfield',
'#title' => t('To Name'),
'#default_value' => isset($defaults['toname']) ? $defaults['toname'] : '',
'#maxlength' => 128,
];
$form['replyto'] = [
'#type' => 'textfield',
'#title' => t('Reply-To'),
'#maxlength' => 128,
'#default_value' => isset($defaults['replyto']) ? $defaults['replyto'] : '',
];
$form['subject'] = [
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => $defaults['subject'],
'#maxlength' => 128,
'#required' => TRUE,
];
$form['include_attachment'] = [
'#title' => t('Include attachment'),
'#type' => 'checkbox',
'#description' => t('If checked, the Drupal icon will be included as an attachment with the test email.'),
'#default_value' => TRUE,
];
$form['body'] = [
'#type' => 'text_format',
'#title' => t('Body'),
'#rows' => 20,
'#default_value' => $defaults['body']['value'],
'#format' => $defaults['body']['format'],
'#required' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Send test message'),
];
return $form;
}