Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Form submit...
*/
function my_module_submit($form, $form_state) {
$email = $form_state['values']['email'];
$message_type = $form_state['values']['message_type'];
$params = array('form_values' => $form_state['values']);
drupal_mail('my_module', $message_type, $email, language_default(), $params);
}
/**
* Implementation of hook_mail().
*/
function my_module_mail($key, &$message, $params) {
switch ($key) {
case 'message_type':
$message['subject'] = $params['form_values']['subject'];
$message['body'][] = $params['form_values']['message'];
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment