contact_mail_page_submit
modules/contact/contact.pages.inc, строка 118
- Версии
- 5
contact_mail_page_submit(
$form_id,$form_values)- 6
contact_mail_page_submit($form, &$form_state)
Process the site-wide contact page form submission.
Код
<?php
function contact_mail_page_submit($form, &$form_state) {
global $language;
$values = $form_state['values'];
// E-mail address of the sender: as the form field is a text field,
// all instances of \r and \n have been automatically stripped from it.
$from = $values['mail'];
// Load category properties and save form values for email composition.
$contact = contact_load($values['cid']);
$values['contact'] = $contact;
// Send the e-mail to the recipients using the site default language.
drupal_mail('contact', 'page_mail', $contact['recipients'], language_default(), $values, $from);
// If the user requests it, send a copy using the current language.
if ($values['copy']) {
drupal_mail('contact', 'page_copy', $from, $language, $values, $from);
}
// Send an auto-reply if necessary using the current language.
if ($contact['reply']) {
drupal_mail('contact', 'page_autoreply', $from, $language, $values, $contact['recipients']);
}
flood_register_event('contact');
watchdog('mail', '%name-from sent an e-mail regarding %category.', array('%name-from' => $values['name'] ." [$from]", '%category' => $contact['category']));
drupal_set_message(t('Your message has been sent.'));
// Jump to home page rather than back to contact page to avoid
// contradictory messages if flood control has been activated.
$form_state['redirect'] = '';
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии