Permalink
Browse files

Issue #458: Upgrade Mailer class to support proper From: address

Closes #458, Closes #548
  • Loading branch information...
1 parent dffab26 commit 1f9d6df632f22c8b6771dacc93d836985131d00b @samwho samwho committed with ginatrapani Jan 10, 2011
Showing with 11 additions and 3 deletions.
  1. +11 −3 webapp/_lib/model/class.Mailer.php
@@ -27,9 +27,17 @@
*/
class Mailer {
public static function mail($to, $subject, $message) {
- $mailheader = "From: \"Auto-Response\" <notifications@host>\r\n";
+ $host = self::getHost();
+ $mailheader = "From: \"Auto-Response\" <notifications@{$host}>\r\n";
$mailheader .= "X-Mailer: PHP/".phpversion();
mail($to, $subject, $message, $mailheader);
}
-}
-?>
+
+ private static function getHost() {
+ if (isset($_SERVER['HTTP_HOST'])) {
+ return $_SERVER['HTTP_HOST'];
+ } else {
+ return "";
+ }
+ }
+}

0 comments on commit 1f9d6df

Please sign in to comment.