Index: trunk/lib/App.inc.php
===================================================================
--- trunk/lib/App.inc.php	(revision 37)
+++ trunk/lib/App.inc.php	(revision 38)
@@ -1003,5 +1003,12 @@
         }
         
-        if ('on' != getenv('HTTPS') && $this->getParam('ssl_enabled') && preg_match('/mod_ssl/i', getenv('SERVER_SOFTWARE'))) {
+        if (function_exists('apache_get_modules')) {
+        	$modules = apache_get_modules();
+        } else {
+            // It's safe to assume we have mod_ssl if we can't determine otherwise.
+            $modules = array('mod_ssl');
+        }
+        
+        if ('on' != getenv('HTTPS') && $this->getParam('ssl_enabled') && in_array('mod_ssl', $modules)) {
             $this->raiseMsg(sprintf(_("Secure SSL connection made to %s"), $this->getParam('ssl_domain')), MSG_NOTICE, __FILE__, __LINE__);
             // Always append session because some browsers do not send cookie when crossing to SSL URL.
Index: trunk/lib/Email.inc.php
===================================================================
--- trunk/lib/Email.inc.php	(revision 37)
+++ trunk/lib/Email.inc.php	(revision 38)
@@ -36,4 +36,5 @@
         'from' => null,
         'subject' => null,
+        'headers' => null,
         'regex' => null
     );
@@ -207,5 +208,5 @@
      * @since   28 Nov 2005 12:56:09
      */
-    function send($to=null, $from=null, $subject=null)
+    function send($to=null, $from=null, $subject=null, $headers=null)
     {
         // Use arguments if provided.
@@ -219,4 +220,7 @@
         	 $this->setParam(array('subject' => $subject));
         }
+        if (isset($headers)) {
+        	 $this->setParam(array('headers' => $headers));
+        }
 
         // Ensure required values exist.
@@ -248,5 +252,17 @@
         
         // From headers are custom headers.
-        $headers = sprintf("From: %s\r\n\r\n", $this->_params['from']); 
+        $headers = array('From' => $this->_params['from']);
+
+        // Additional headers.
+        if (isset($this->_params['headers']) && is_array($this->_params['headers'])) {
+            $headers = array_merge($this->_params['headers'], $headers);
+        }
+        
+        // Process headers.
+        $final_headers = array();
+        foreach ($headers as $key => $val) {
+            $final_headers[] = sprintf('%s: %s', $key, $val);
+        }
+        $final_headers = join("\r\n", $final_headers);
         
         // This is the address where delivery problems are sent to. We must strip off everything except the local@domain part.
@@ -254,5 +270,5 @@
         
         // Check for mail header injection attacks.
-        $full_mail_content = join("\n", array($final_to, $this->_params['subject'], $final_body, $headers, $envelope_sender_header));
+        $full_mail_content = join("\n", array($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header));
         if (preg_match("/(Content-Type:|MIME-Version:|Content-Transfer-Encoding:|[\n\r]Bcc:|[\n\r]Cc:)/i", $full_mail_content)) {
         	App::logMsg(sprintf('Mail header injection attack in content: %s', $full_mail_content), LOG_WARNING, __FILE__, __LINE__);
@@ -262,6 +278,6 @@
 
         // Ensure message was successfully accepted for delivery.
-        if (!mail($final_to, $this->_params['subject'], $final_body, $headers, $envelope_sender_header)) {
-            App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", '', $headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__);
+        if (!mail($final_to, $this->_params['subject'], $final_body, $final_headers, $envelope_sender_header)) {
+            App::logMsg(sprintf('Email failure with parameters: %s, %s, %s, %s', $this->_params['to'], $this->_params['subject'], str_replace("\r\n", '', $final_headers), $envelope_sender_header), LOG_NOTICE, __FILE__, __LINE__);
             return false;
         }
Index: trunk/lib/MCVE.inc.php
===================================================================
--- trunk/lib/MCVE.inc.php	(revision 37)
+++ trunk/lib/MCVE.inc.php	(revision 38)
@@ -26,4 +26,7 @@
             trigger_error('MCVE class instantiation failed: MCVE extension not available.', E_USER_WARNING);
             die;
+        }
+        if ('' == $username || '' == $password) {
+        	App::logMsg(sprintf('Empty username or password provided.', null), LOG_ERR, __FILE__, __LINE__);
         }
         $this->username = $username;
