A mail is what's stored at the IMAP/POP3 server. A message is information from an...
[squirrelmail.git] / functions / compose.php
index 753c3888140f11cebc2d2a984d2081487328ddd1..15f4829c27e755d3f80c075eef21f53242513c26 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 &copy; 1999-2009 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -93,6 +93,9 @@ function sq_get_attach_tempfile()
 function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='', $message='')
 {
 
+   require_once(SM_PATH . 'functions/mime.php');
+   require_once(SM_PATH . 'class/mime.class.php');
+
    if (empty($message))
    {
       $message = new Message();
@@ -127,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;