[Vtigercrm-commits] [vtiger-commits] r6731 - in /vtigercrm/trunk/modules/Emails: Save.php mail.php webmailsend.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon May 29 23:01:32 EDT 2006


Author: mmbrich
Date: Mon May 29 21:01:30 2006
New Revision: 6731

Log:
added ability to send from webmail without a parent_id

Added:
    vtigercrm/trunk/modules/Emails/webmailsend.php   (with props)
Modified:
    vtigercrm/trunk/modules/Emails/Save.php
    vtigercrm/trunk/modules/Emails/mail.php

Modified: vtigercrm/trunk/modules/Emails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Save.php (original)
+++ vtigercrm/trunk/modules/Emails/Save.php Mon May 29 21:01:30 2006
@@ -39,7 +39,7 @@
 	sqgetGlobalVar('onetimepad',$onetimepad,    SQ_SESSION);
 	$mailbox = 'INBOX';
 }
-
+
 require_once('modules/Emails/Email.php');
 require_once('include/logging.php');
 require_once('include/database/PearDatabase.php');
@@ -194,24 +194,23 @@
 else $return_action = "DetailView";
 if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = $_REQUEST['return_id'];
 if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "") $filename = $_REQUEST['filename'];
-
-$local_log->debug("Saved record with id of ".$return_id);
-
-if( isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'])
-{
+
+$local_log->debug("Saved record with id of ".$return_id);
+
+if($_REQUEST["parent_name"] != '' && isset($_REQUEST["parent_name"])) {
+	include("modules/Emails/webmailsend.php");
+
+} elseif( isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'])
 	include("modules/Emails/mailsend.php");
-}
-elseif(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'mailbox')
-{
-	header("Location: index.php?module=$return_module&action=index");
-}
-else
-{
-	//code added for returning back to the current view after edit from list view
-	if($_REQUEST['return_viewname'] == '') $return_viewname='0';
+
+
+
+if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'mailbox')
+	header("Location: index.php?module=$return_module&action=index");
+else {
+	if($_REQUEST['return_viewname'] == '') $return_viewname='0';
 	if($_REQUEST['return_viewname'] != '')$return_viewname=$_REQUEST['return_viewname'];
 	$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
 	echo $inputs;
-	//header("Location: index.php?action=$return_action&module=$return_module&parent_id=$parent_id&record=$return_id&filename=$filename&viewname=$return_viewname");
 }
 ?>

Modified: vtigercrm/trunk/modules/Emails/mail.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/mail.php (original)
+++ vtigercrm/trunk/modules/Emails/mail.php Mon May 29 21:01:30 2006
@@ -138,7 +138,8 @@
   *	$contents	-- body of the email you want to send
   *	$from_email	-- from email id which will be displayed in the mail
   *	$from_name	-- from name which will be displayed in the mail
-  *	$to_email 	-- to email address 
+  *	$to_email 	-- to email address  -- This can be an email in a single string, a comma separated
+  *			   list of emails or an array of email addresses
   *	$attachment	-- whether we want to attach the currently selected file or all files.
   				[values = current,all] - optional
   *	$emailid	-- id of the email object which will be used to get the attachments - optional
@@ -167,7 +168,16 @@
 
 	if($to_email != '')
 	{
-		$mail->AddAddress($to_email);
+		if(is_array($to_email)) {
+			for($j=0,$num=count($to_email);$j<$num;$j++) {
+				$mail->addAddress($to_email[$j]);
+			}
+		} else {
+			$_tmp = explode(",",$to_email);
+			for($j=0,$num=count($_tmp);$j<$num;$j++) {
+				$mail->addAddress($_tmp[$j]);
+			}
+		}
 	}
 
 	$mail->AddReplyTo($from_email);





More information about the vtigercrm-commits mailing list