-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read send_email from config file and act appropriately
- Loading branch information
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,15 @@ private function get_webPortalURL() { | |
} | ||
|
||
|
||
/** | ||
* Return whether send_email is enabled in the config file | ||
*/ | ||
private function get_config_send_email() { | ||
$localInfoXML = simplexml_load_file(__DIR__ . "/../../config/local_info.xml"); | ||
return strtolower($localInfoXML->local_info->send_email) === 'true'; | ||
} | ||
|
||
|
||
private function mock_mail($to, $subject, $message, $additional_headers = "", $additional_parameters = "") { | ||
echo "<!--\n"; | ||
echo "Sending mail disabled, but would have sent:\n"; | ||
|
@@ -165,7 +174,7 @@ private function send_email($role_requested, $requesting_user, $entity_name, $ap | |
$email = $approving_user->getEmail(); | ||
$headers = "From: [email protected]"; | ||
|
||
if (True) { | ||
if (get_config_send_email()) { | ||
mail($email, $subject, $body, $headers); | ||
} else { | ||
mock_mail($email, $subject, $body, $headers); | ||
|