diff --git a/config/local_info.xml b/config/local_info.xml
index c3e1eab9f..6115d7ed8 100755
--- a/config/local_info.xml
+++ b/config/local_info.xml
@@ -13,6 +13,10 @@
+
+ no-reply@localhost
+ gocdb-admins@localhost
+
AUP location
AUP title
diff --git a/lib/Gocdb_Services/Config.php b/lib/Gocdb_Services/Config.php
index d2fc46259..b7bd22328 100644
--- a/lib/Gocdb_Services/Config.php
+++ b/lib/Gocdb_Services/Config.php
@@ -542,4 +542,18 @@ public function getPageBanner()
return $bannerText;
}
+
+ public function getEmailFrom()
+ {
+ $emailFrom = $this->GetLocalInfoXML()->email_from;
+
+ return $emailFrom;
+ }
+
+ public function getEmailTo()
+ {
+ $emailTo = $this->GetlocalInfoXML()->email_to;
+
+ return $emailTo;
+ }
}
diff --git a/lib/Gocdb_Services/LinkIdentity.php b/lib/Gocdb_Services/LinkIdentity.php
index 4dc8e2903..64b365033 100644
--- a/lib/Gocdb_Services/LinkIdentity.php
+++ b/lib/Gocdb_Services/LinkIdentity.php
@@ -243,6 +243,8 @@ public function getRequestByConfirmationCode($code) {
*/
private function composeEmail($primaryIdString, $currentIdString, $primaryAuthType, $currentAuthType, $isLinking, $isRegistered, $isPrimary, $link=null) {
+ $configService = \Factory::getConfigService();
+
$subject = "Validation of " . ($isLinking ? "linking" : "recovering") . " your GOCDB account";
$body = "Dear GOCDB User,"
@@ -274,7 +276,8 @@ private function composeEmail($primaryIdString, $currentIdString, $primaryAuthTy
. "\n\n$link";
}
- $body .= "\n\nIf you did not create this request, please immediately contact gocdb-admins@mailman.egi.eu";
+ $emailSendTo = $configService->getEmailTo();
+ $body .= "\n\nIf you did not create this request, please immediately contact " . $emailSendTo;
return array('subject'=>$subject, 'body'=>$body);
}
@@ -293,6 +296,8 @@ private function composeEmail($primaryIdString, $currentIdString, $primaryAuthTy
*/
private function sendConfirmationEmails($primaryUser, $currentUser, $code, $primaryIdString, $currentIdString, $primaryAuthType, $currentAuthType, $isLinking, $isRegistered) {
+ $configService = \Factory::getConfigService();
+
// Create link to be clicked in email
$portalUrl = \Factory::getConfigService()->GetPortalURL();
$link = $portalUrl."/index.php?Page_Type=User_Validate_Identity_Link&c=" . $code;
@@ -304,7 +309,8 @@ private function sendConfirmationEmails($primaryUser, $currentUser, $code, $prim
$primaryBody = $composedPrimaryEmail['body'];
// If "sendmail_from" is set in php.ini, use second line ($headers = '';):
- $headers = "From: GOCDB ";
+ $emailSentFrom = $configService->getEmailFrom();
+ $headers = "From: GOCDB <" . $emailSentFrom . ">";
// Mail command returns boolean. False if message not accepted for delivery.
if (!mail($primaryUser->getEmail(), $primarySubject, $primaryBody, $headers)) {
@@ -414,4 +420,4 @@ public function confirmIdentityLinking($code, $currentIdString) {
return $request;
}
-}
\ No newline at end of file
+}
diff --git a/lib/Gocdb_Services/NotificationService.php b/lib/Gocdb_Services/NotificationService.php
index 20ad162e0..3e8025d5d 100644
--- a/lib/Gocdb_Services/NotificationService.php
+++ b/lib/Gocdb_Services/NotificationService.php
@@ -113,6 +113,8 @@ private function sendEmail($roleRequested, $requestingUser, $entityName, $approv
$roleRequested->getOwnedEntity()->getName()
);
+ $configService = \Factory::getConfigService();
+
$body = sprintf(
implode("\n", array(
'Dear %1$s,',
@@ -123,17 +125,23 @@ private function sendEmail($roleRequested, $requestingUser, $entityName, $approv
' %6$s/index.php?Page_Type=Role_Requests',
'',
'Note: This role could already have been approved or denied by another GOCDB User',
+ '',
+ 'Please do not reply to this email. If you would like to get in touch with the ' .
+ 'GOCDB admins please send an email to: %7$s',
)),
$approvingUser->getForename(),
$requestingUser->getForename(),
$requestingUser->getSurname(),
$roleRequested->getRoleType()->getName(),
$roleRequested->getOwnedEntity()->getName(),
- $this->getWebPortalURL()
+ $this->getWebPortalURL(),
+ $configService->getEmailTo()
);
$emailAddress = $approvingUser->getEmail();
- $headers = "From: GOCDB ";
+
+ $emailSentFrom = $configService->getEmailFrom();
+ $headers = "From: GOCDB <" . $emailSentFrom . ">";
\Factory::getEmailService()->send($emailAddress, $subject, $body, $headers);
}
diff --git a/resources/RemoveInactiveUsersRunner.php b/resources/RemoveInactiveUsersRunner.php
index 4d157bd0c..e1550f363 100644
--- a/resources/RemoveInactiveUsersRunner.php
+++ b/resources/RemoveInactiveUsersRunner.php
@@ -176,8 +176,14 @@ function sendWarningEmail($user, $elapsedMonths, $deletionThreshold)
{
$emailAddress = $user->getEmail();
+ $configService = \Factory::getConfigService();
+
+ $emailSentFrom = $configService->getEmailFrom();
+
+ $emailSendTo = $configService->getEmailTo();
+
// Email content
- $headers = "From: GOCDB ";
+ $headers = "From: GOCDB <" . $emailSentFrom . ">";
$subject = "GOCDB: User account deletion notice";
$body = "Dear ". $user->getForename() .",\n\n" .
@@ -202,7 +208,9 @@ function sendWarningEmail($user, $elapsedMonths, $deletionThreshold)
$body .= "\n";
$body .= "You can prevent the deletion of this account by visiting the " .
"GOCDB portal while authenticated with one of the above " .
- "identifiers.\n";
+ "identifiers.\n\n";
+ $body .= "Please do not reply to this email. If you would like to get in touch " .
+ "with the GOCDB admins please send an email to: " . $emailSendTo . "\n";
// Handle all mail related printing/debugging