Created
May 17, 2012 21:12
-
-
Save vkareh/2721620 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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