Commit 9e45d24a authored by Dries's avatar Dries

- Patch #26236 by Robin Monks: added 'send me a copy'-functionality to the contact forms.

parent 6baa2ba1
......@@ -129,6 +129,11 @@ function contact_mail_user() {
// Send the e-mail:
user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// Send a copy if requested:
if ($edit['copy']) {
user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
}
// Log the operation:
flood_register_event('contact');
watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => theme('placeholder', $user->name), '%name-to' => theme('placeholder', $account->name))));
......@@ -148,6 +153,7 @@ function contact_mail_user() {
$output .= form_item(t('To'), $account->name);
$output .= form_textfield(t('Subject'), 'subject', $edit['subject'], 60, 50, NULL, NULL, TRUE);
$output .= form_textarea(t('Message'), 'message', $edit['message'], 60, 15, NULL, NULL, TRUE);
$output .= form_checkbox(t('Send me a copy.'), 'copy', $edit['copy']);
$output .= form_submit(t('Send e-mail'));
$output = form($output);
}
......@@ -280,6 +286,11 @@ function contact_mail_page() {
// Send the e-mail to the recipients:
user_mail($contact->recipients, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// If the user requests it, send a copy.
if ($edit['copy']) {
user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
}
// Send an auto-reply if necessary:
if ($contact->reply) {
user_mail($from, $subject, wordwrap($contact->reply), "From: $contact->recipients\nReply-to: $contact->recipients\nX-Mailer: Drupal\nReturn-path: $contact->recipients\nErrors-to: $contact->recipients");
......@@ -316,6 +327,7 @@ function contact_mail_page() {
$output .= form_select(t('Category'), 'category', $edit['category'], $categories, NULL, NULL, NULL, TRUE);
}
$output .= form_textarea(t('Message'), 'message', $edit['message'], 60, 5, NULL, NULL, TRUE);
$output .= form_checkbox(t('Send me a copy.'), 'copy', $edit['copy']);
$output .= form_submit(t('Send e-mail'));
$output = form($output);
}
......
......@@ -129,6 +129,11 @@ function contact_mail_user() {
// Send the e-mail:
user_mail($to, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// Send a copy if requested:
if ($edit['copy']) {
user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
}
// Log the operation:
flood_register_event('contact');
watchdog('mail', t('%name-from sent %name-to an e-mail.', array('%name-from' => theme('placeholder', $user->name), '%name-to' => theme('placeholder', $account->name))));
......@@ -148,6 +153,7 @@ function contact_mail_user() {
$output .= form_item(t('To'), $account->name);
$output .= form_textfield(t('Subject'), 'subject', $edit['subject'], 60, 50, NULL, NULL, TRUE);
$output .= form_textarea(t('Message'), 'message', $edit['message'], 60, 15, NULL, NULL, TRUE);
$output .= form_checkbox(t('Send me a copy.'), 'copy', $edit['copy']);
$output .= form_submit(t('Send e-mail'));
$output = form($output);
}
......@@ -280,6 +286,11 @@ function contact_mail_page() {
// Send the e-mail to the recipients:
user_mail($contact->recipients, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
// If the user requests it, send a copy.
if ($edit['copy']) {
user_mail($from, $subject, $body, "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
}
// Send an auto-reply if necessary:
if ($contact->reply) {
user_mail($from, $subject, wordwrap($contact->reply), "From: $contact->recipients\nReply-to: $contact->recipients\nX-Mailer: Drupal\nReturn-path: $contact->recipients\nErrors-to: $contact->recipients");
......@@ -316,6 +327,7 @@ function contact_mail_page() {
$output .= form_select(t('Category'), 'category', $edit['category'], $categories, NULL, NULL, NULL, TRUE);
}
$output .= form_textarea(t('Message'), 'message', $edit['message'], 60, 5, NULL, NULL, TRUE);
$output .= form_checkbox(t('Send me a copy.'), 'copy', $edit['copy']);
$output .= form_submit(t('Send e-mail'));
$output = form($output);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment