Allow caller to get message object before sending
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 12 Sep 2018 18:28:28 +0000 (18:28 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 12 Sep 2018 18:28:28 +0000 (18:28 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14776 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/compose.php

index 96c110e0771a9de43912085f7ba47a2dbb2f4e02..48c9544f1bb43b156df1c1139fba570f9764c552 100644 (file)
@@ -82,6 +82,13 @@ function sq_get_attach_tempfile()
   *                        or Sendmail.  If this parameter is non-
   *                        empty, all other parameters are ignored.
   *                        (OPTIONAL: default is empty)
   *                        or Sendmail.  If this parameter is non-
   *                        empty, all other parameters are ignored.
   *                        (OPTIONAL: default is empty)
+  * @param boolean $only_build_message_object When TRUE, only builds the
+  *                                           message object that it
+  *                                           intends to send and returns
+  *                                           it (returned success code
+  *                                           will be -1 and message ID
+  *                                           emtpy) (OPTIONAL; default
+  *                                           is FALSE)
   *
   * @return array A three-element array, the first element being a
   *               boolean value indicating if the message was successfully
   *
   * @return array A three-element array, the first element being a
   *               boolean value indicating if the message was successfully
@@ -89,9 +96,13 @@ function sq_get_attach_tempfile()
   *               assigned Message-ID, if available (only available as of
   *               SquirrelMail 1.4.14 and 1.5.2), and the third element
   *               being the message object itself.
   *               assigned Message-ID, if available (only available as of
   *               SquirrelMail 1.4.14 and 1.5.2), and the third element
   *               being the message object itself.
+  *               If $only_build_message_object is TRUE, only the third
+  *               element is useful; first two should be ignored - the
+  *               message is never sent in this case.
   *
   */
   *
   */
-function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='', $message='')
+function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='',
+                      $message='', $only_build_message_object=FALSE)
 {
 
    require_once(SM_PATH . 'functions/mime.php');
 {
 
    require_once(SM_PATH . 'functions/mime.php');
@@ -123,6 +134,10 @@ function sq_send_mail($to, $subject, $body, $from, $cc='', $bcc='', $message='')
 //sm_print_r($message);exit;
 
 
 //sm_print_r($message);exit;
 
 
+   if ($only_build_message_object)
+      return array(-1, '', $message);
+
+
    global $useSendmail;
 
 
    global $useSendmail;