From 2809f2b84afe78ecd85b6fcbeab43efc14c02a0b Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 20 Jan 2012 07:32:12 +0000
Subject: [PATCH] cron: Set the From-address to be the technical contact email
 address.

To avoid sending email with a From-address belonging to an external
domain, set it to the same as the technical contact address.

Thanks to Dick Visser for adding this!

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3021 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/cron/www/cron.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/cron/www/cron.php b/modules/cron/www/cron.php
index 0306e85cb..ac5390a8f 100644
--- a/modules/cron/www/cron.php
+++ b/modules/cron/www/cron.php
@@ -42,7 +42,8 @@ if ($cronconfig->getValue('sendemail', TRUE) && count($summary) > 0) {
 	if($toaddress == 'na@example.org') {
 		SimpleSAML_Logger::error('Cron - Could not send email. [technicalcontact_email] not set in config.');
 	} else {
-		$email = new SimpleSAML_XHTML_EMail($toaddress, 'simpleSAMLphp cron report', 'no-reply@simplesamlphp.com');
+		// Use $toaddress for both TO and FROM
+		$email = new SimpleSAML_XHTML_EMail($toaddress, 'SimpleSAMLphp cron report', $toaddress);
 		$email->setBody($message);
 		$email->send();
 	}
-- 
GitLab