summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Stephen Lee2017-01-11 15:23:46 +0530
committerThomas Stephen Lee2017-01-11 15:23:46 +0530
commit745d226aa12c0dc7c6f2aa608d473559e02dc761 (patch)
tree51959a33eccc7dc10efa1251e082421abcf8caff
parent3639a32c7d0660ec6aca46772fa4999734e9949d (diff)
downloadDWSIM_textbook_companion-745d226aa12c0dc7c6f2aa608d473559e02dc761.tar.gz
DWSIM_textbook_companion-745d226aa12c0dc7c6f2aa608d473559e02dc761.tar.bz2
DWSIM_textbook_companion-745d226aa12c0dc7c6f2aa608d473559e02dc761.zip
fixed mail function
-rwxr-xr-xcode.inc46
1 files changed, 35 insertions, 11 deletions
diff --git a/code.inc b/code.inc
index dd1ebd5..2966162 100755
--- a/code.inc
+++ b/code.inc
@@ -422,10 +422,22 @@ function upload_examples_form_submit($form, &$form_state)
} //$_FILES['files']['name'] as $file_form_name => $file_name
drupal_set_message('Example uploaded successfully.', 'status');
/* sending email */
- $email_to = $user->mail;
+ $email_to = $user->mail;
+ $from = variable_get('textbook_companion_from_email', '');
+ $bcc = variable_get('textbook_companion_bcc_emails', '');
+ $cc = variable_get('textbook_companion_cc_emails', '');
$params['example_uploaded']['example_id'] = $example_id;
- $params['example_uploaded']['user_id'] = $user->uid;
- if (!drupal_mail('textbook_companion', 'example_uploaded', $email_to, language_default(), $params, variable_get('textbook_companion_from_email', NULL), TRUE))
+ $params['example_uploaded']['user_id'] = $user->uid;
+ $params['example_uploaded']['headers'] = array(
+ 'From' => $from,
+ 'MIME-Version' => '1.0',
+ 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer' => 'Drupal',
+ 'Cc' => $cc,
+ 'Bcc' => $bcc
+ );
+ if (!drupal_mail('textbook_companion', 'example_uploaded', $email_to, language_default(), $params, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
drupal_goto('textbook-companion/code');
}
@@ -501,14 +513,26 @@ function _upload_examples_delete()
if (delete_example($example_data->id)) {
drupal_set_message('Example deleted.', 'status');
/* sending email */
- $email_to = $user->mail;
- $params['example_deleted_user']['book_title'] = $preference_data->book;
- $params['example_deleted_user']['chapter_title'] = $chapter_data->name;
- $params['example_deleted_user']['example_number'] = $example_data->number;
- $params['example_deleted_user']['example_caption'] = $example_data->caption;
- $params['example_deleted_user']['user_id'] = $user->uid;
- if (!drupal_mail('textbook_companion', 'example_deleted_user', $email_to, language_default(), $params, variable_get('textbook_companion_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ $email_to = $user->mail;
+ $from = variable_get('textbook_companion_from_email', '');
+ $bcc = variable_get('textbook_companion_emails', '');
+ $cc = variable_get('textbook_companion_cc_emails', '');
+ $params['example_deleted_user']['book_title'] = $preference_data->book;
+ $params['example_deleted_user']['chapter_title'] = $chapter_data->name;
+ $params['example_deleted_user']['example_number'] = $example_data->number;
+ $params['example_deleted_user']['example_caption'] = $example_data->caption;
+ $params['example_deleted_user']['user_id'] = $user->uid;
+ $params['example_deleted_user']['headers'] = array(
+ 'From' => $from,
+ 'MIME-Version' => '1.0',
+ 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer' => 'Drupal',
+ 'Cc' => $cc,
+ 'Bcc' => $bcc
+ );
+ if (!drupal_mail('textbook_companion', 'example_deleted_user', $email_to, language_default(), $params, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
} //delete_example($example_data->id)
else {
drupal_set_message('Error deleting example.', 'status');