diff options
author | prashant | 2015-11-04 18:10:42 +0530 |
---|---|---|
committer | prashant | 2015-11-04 18:10:42 +0530 |
commit | bd61ca0bae497fef876a3b8c716e70919e651474 (patch) | |
tree | ce2c3041afda690d0f7ea29af3e4ae9cd4925d2b /general_deletion.inc | |
parent | cf4aee0e5675851843062a070ed67b3194ddd7cf (diff) | |
download | DWSIM_lab_migration-bd61ca0bae497fef876a3b8c716e70919e651474.tar.gz DWSIM_lab_migration-bd61ca0bae497fef876a3b8c716e70919e651474.tar.bz2 DWSIM_lab_migration-bd61ca0bae497fef876a3b8c716e70919e651474.zip |
mail function modifed and formated the code
Diffstat (limited to 'general_deletion.inc')
-rwxr-xr-x | general_deletion.inc | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/general_deletion.inc b/general_deletion.inc index b6622b2..dbc9b8e 100755 --- a/general_deletion.inc +++ b/general_deletion.inc @@ -55,17 +55,28 @@ function lab_migration_delete_solution($solution_id) $status = FALSE; drupal_set_message(t('Error deleting !file', array('!file' => $solution_files_data->filepath)), 'error'); - /* sending email to admins */ + /* sending email to admins */ $email_to = variable_get('lab_migration_emails', ''); + + $from = variable_get('lab_migration_from_email', ''); + $bcc=""; + $cc=variable_get('lab_migration_cc_emails', ''); + $param['standard']['subject'] = "[ERROR] Error deleting example file"; $param['standard']['body'] = "Error deleting solution files by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " : solution id : " . $solution_id . " file id : " . $solution_files_data->id . " - file path : " . $solution_files_data->filepath; - if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) + file path : " . $solution_files_data->filepath." + PDF path : " . $PdfStatus; + $param['standard']['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('lab_migration', 'standard', $email_to, language_default(), $param, $from, TRUE)) drupal_set_message('Error sending email message.', 'error'); } else { - /* deleting example files database entries */ + /* deleting example files database entries */ db_delete('lab_migration_solution_files') ->condition('id', $solution_files_data->id) @@ -87,9 +98,20 @@ function lab_migration_delete_solution($solution_id) /* sending email to admins */ $email_to = variable_get('lab_migration_emails', ''); + $from = variable_get('lab_migration_from_email', ''); + $bcc=""; + $cc=variable_get('lab_migration_cc_emails', ''); + + $param['standard']['subject'] = "[ERROR] Error deleting folder"; $param['standard']['body'] = "Error deleting folder " . $dir_path . " by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) + $param['standard']['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('lab_migration', 'standard', $email_to, language_default(), $param, $from, TRUE)) drupal_set_message('Error sending email message.', 'error'); return FALSE; } @@ -145,7 +167,7 @@ function lab_migration_delete_experiment($experiment_id) if ($status) { - $dir_path = $root_path . $experiment_data->proposal_id . '/EXP' . $experiment_data->number; + $dir_path = $root_path . $experiment_data->directory_name . '/EXP' . $experiment_data->number; if (is_dir($dir_path)) { @@ -154,11 +176,21 @@ function lab_migration_delete_experiment($experiment_id) { drupal_set_message(t('Error deleting experiment folder !folder', array('!folder' => $dir_path)), 'error'); - /* sending email to admins */ + /* sending email to admins */ $email_to = variable_get('lab_migration_emails', ''); + + $from = variable_get('lab_migration_from_email', ''); + $bcc=""; + $cc=variable_get('lab_migration_cc_emails', ''); + + $param['standard']['subject'] = "[ERROR] Error deleting experiment folder"; $param['standard']['body'] = "Error deleting folder " . $dir_path; - if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) + $param['standard']['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('lab_migration', 'standard', $email_to, language_default(), $param,$from, TRUE)) drupal_set_message('Error sending email message.', 'error'); return FALSE; } else { @@ -249,12 +281,21 @@ function lab_migration_delete_dependency($dependency_id) /* sending email to admins */ $email_to = variable_get('lab_migration_emails', ''); + $from = variable_get('lab_migration_from_email', ''); + $bcc=""; + $cc=variable_get('lab_migration_cc_emails', ''); + $param['standard']['subject'] = "[ERROR] Error deleting dependency file"; $param['standard']['body'] = "Error deleting dependency files by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " : dependency id : " . $dependency_id . " file id : " . $dependency_files_data->id . " file path : " . $dependency_files_data->filepath; - if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) + $param['standard']['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('lab_migration', 'standard', $email_to, language_default(), $param,$from, TRUE)) drupal_set_message('Error sending email message.', 'error'); } else { /* deleting dependency files database entries */ |