Skip to content
Snippets Groups Projects
Commit f7d5f95d authored by Thijs Kinkhorst's avatar Thijs Kinkhorst Committed by GitHub
Browse files

Merge pull request #684 from tvdijen/patch-email-from

Add sendmail_from option
parents 1f4b6e84 5a666cb2
No related branches found
No related tags found
No related merge requests found
......@@ -76,6 +76,13 @@ $config = array(
'technicalcontact_name' => 'Administrator',
'technicalcontact_email' => 'na@example.org',
/*
* The envelope from address for outgoing emails.
* This should be in a domain that has your application's IP addresses in its SPF record
* to prevent it from being rejected by mail filters.
*/
//'sendmail_from' => 'no-reply@example.org',
/*
* The timezone of the server. This option should be set to the timezone you want
* SimpleSAMLphp to report the time in. The default is to guess the timezone based
......
......@@ -101,10 +101,21 @@ $email = trim($email);
// check that it looks like a valid email address
if (!preg_match('/\s/', $email) && strpos($email, '@') !== false) {
$replyto = $email;
$from = $email;
} else {
$replyto = null;
$from = 'no-reply@simplesamlphp.org';
}
$from = $config->getString('sendmail_from', null);
if ($from === null || $from === '') {
$from = ini_get('sendmail_from');
if ($from === '' || $from === false) {
$from = 'no-reply@example.org';
}
}
// If no sender email was configured at least set some relevant from address
if ($from === 'no-reply@example.org' && $replyto !== null) {
$from = $replyto;
}
// send the email
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment