Squash bugs
[squirrelmail.git] / functions / compose.php
index dd8ddcac3626eb0348bb2cd68a9c7902fa9ae137..43a5adc4a71715b01f4512c6fb2f7fecc4663425 100644 (file)
@@ -6,7 +6,7 @@
  * Functions for message compositon: writing a message, attaching files etc.
  *
  * @author Thijs Kinkhorst <kink at squirrelmail.org>
- * @copyright &copy; 1999-2007 The SquirrelMail Project Team
+ * @copyright 1999-2016 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -105,9 +105,9 @@ function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='', $message='')
       $content_type = new ContentType('text/plain');
       global $special_encoding, $default_charset;
       if ($special_encoding)
-         $rfc822_header->encoding = $special_encoding;
+         $header->encoding = $special_encoding;
       else
-         $rfc822_header->encoding = '8bit';
+         $header->encoding = '8bit';
       if ($default_charset)
          $content_type->properties['charset']=$default_charset;
       $header->content_type = $content_type;
@@ -130,14 +130,16 @@ function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='', $message='')
    if (!$useSendmail) {
       require_once(SM_PATH . 'class/deliver/Deliver_SMTP.class.php');
       $deliver = new Deliver_SMTP();
-      global $smtpServerAddress, $smtpPort, $pop_before_smtp, $domain;
+      global $smtpServerAddress, $smtpPort, $pop_before_smtp,
+             $domain, $pop_before_smtp_host;
 
       $authPop = (isset($pop_before_smtp) && $pop_before_smtp) ? true : false;
+      if (empty($pop_before_smtp_host)) $pop_before_smtp_host = $smtpServerAddress;
       $user = '';
       $pass = '';
       get_smtp_user($user, $pass);
       $stream = $deliver->initStream($message,$domain,0,
-                $smtpServerAddress, $smtpPort, $user, $pass, $authPop);
+                $smtpServerAddress, $smtpPort, $user, $pass, $authPop, $pop_before_smtp_host);
    } else {
       require_once(SM_PATH . 'class/deliver/Deliver_SendMail.class.php');
       global $sendmail_path, $sendmail_args;