[Vtigercrm-commits] [vtiger-commits] r10874 - in /vtigercrm/branches/5.0.3/modules/Emails: EditView.php Save.php language/en_us.lang.php mailsend.php webmailsend.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri May 11 16:40:54 EDT 2007


Author: richie
Date: Fri May 11 14:40:45 2007
New Revision: 10874

Log:
* Fixed the issues in mail sending, Fixed #3708#3759

Modified:
    vtigercrm/branches/5.0.3/modules/Emails/EditView.php
    vtigercrm/branches/5.0.3/modules/Emails/Save.php
    vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php
    vtigercrm/branches/5.0.3/modules/Emails/mailsend.php
    vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php

Modified: vtigercrm/branches/5.0.3/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/EditView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/EditView.php Fri May 11 14:40:45 2007
@@ -119,7 +119,7 @@
 	}
 
 	$smarty->assign('TO_MAIL',$email1);
-	$smarty->assign('BCC_MAIL',$current_user->email1);
+	//$smarty->assign('BCC_MAIL',$current_user->email1);
 }
 
 //handled for replying emails
@@ -163,7 +163,7 @@
 	  $hdr = @imap_headerinfo($mbox, $mailid);
 	$smarty->assign('WEBMAIL',"true");
 	if($_REQUEST["reply"] == "all") {
-		$smarty->assign('TO_MAIL',$webmail->fromaddr);	
+		$smarty->assign('TO_MAIL',$webmail->from);	
 		$smarty->assign('CC_MAIL',str_replace(" ","",$hdr->ccaddress));
 		/*if(is_array($webmail->cc_list))
 		{
@@ -290,6 +290,8 @@
 }
 if($ret_error == 1) {
 	$smarty->assign("RET_ERROR",$ret_error);
+	if($ret_parentid != '')
+		$smarty->assign("IDLISTS",$ret_parentid);
 	if($ret_toadd != '')
                 $smarty->assign("TO_MAIL",$ret_toadd);
 	$ret_toadd = '';

Modified: vtigercrm/branches/5.0.3/modules/Emails/Save.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/Save.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/Save.php Fri May 11 14:40:45 2007
@@ -88,6 +88,7 @@
 	else{}
 	if($errormessage != ""){
 		$ret_error = 1;
+		$ret_parentid = $_REQUEST['parent_id'];
 		$ret_toadd = $_REQUEST['parent_name'];
 		$ret_subject = $_REQUEST['subject'];
 		$ret_ccaddress = $_REQUEST['ccmail'];
@@ -98,7 +99,29 @@
 		exit();
 	}
 }
-
+if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail']) {
+	require_once("modules/Emails/mail.php");
+	if($_REQUEST['parent_id'] == '')
+		$user_mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],'','','all',$focus->id);
+	else
+		$user_mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST['ccmail'],$_REQUEST['bccmail'],'all',$focus->id);
+		
+//if block added to fix the issue #3759
+	if($user_mail_status != 1){
+        	$error_msg = "<font color=red><strong>".$mod_strings['LBL_CHECK_USER_MAILID']."</strong></font>";
+	        $ret_error = 1;
+		$ret_parentid = $_REQUEST['parent_id'];
+	        $ret_toadd = $_REQUEST['parent_name'];
+        	$ret_subject = $_REQUEST['subject'];
+	        $ret_ccaddress = $_REQUEST['ccmail'];
+        	$ret_bccaddress = $_REQUEST['bccmail'];
+	        $ret_description = $_REQUEST['description'];
+        	echo $error_msg;
+	        include("EditView.php");
+        	exit();
+	}
+
+}
 if($_FILES["filename"]["size"] == 0 && $_FILES["filename"]["name"] != '')
 {
         $file_upload_error = true;
@@ -219,10 +242,10 @@
 $userid = $current_user->id;
 if($adb->num_rows($result) > 0)
 {
-	$query = 'update vtiger_emaildetails set to_email="'.$all_to_ids.'",cc_email="'.$all_cc_ids.'",bcc_email="'.$all_bcc_ids.'",idlists="'.$userid."@-1|".$_REQUEST["parent_id"].'",email_flag="SAVED" where emailid = '.$email_id;
+	$query = 'update vtiger_emaildetails set to_email="'.$all_to_ids.'",cc_email="'.$all_cc_ids.'",bcc_email="'.$all_bcc_ids.'",idlists="'.$_REQUEST["parent_id"].'",email_flag="SAVED" where emailid = '.$email_id;
 }else
 {
-	$query = 'insert into vtiger_emaildetails values ('.$email_id.',"'.$user_email.'","'.$all_to_ids.'","'.$all_cc_ids.'","'.$all_bcc_ids.'","","'.$userid."@-1|".$_REQUEST["parent_id"].'","SAVED")';
+	$query = 'insert into vtiger_emaildetails values ('.$email_id.',"'.$user_email.'","'.$all_to_ids.'","'.$all_cc_ids.'","'.$all_bcc_ids.'","","'.$_REQUEST["parent_id"].'","SAVED")';
 }
 $adb->query($query);
 
@@ -248,8 +271,8 @@
 if(isset($_REQUEST['filename']) && $_REQUEST['filename'] != "") $filename = $_REQUEST['filename'];
 
 $local_log->debug("Saved record with id of ".$return_id);
-$str = $_REQUEST['parent_id'];
-if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] == '' || substr($str,strlen($str)-4) == '@-1|'){
+
+if(isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'] && $_REQUEST['parent_id'] == ''){
 	if($_REQUEST["parent_name"] != '' && isset($_REQUEST["parent_name"])) {
 		include("modules/Emails/webmailsend.php");
 	}

Modified: vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/language/en_us.lang.php Fri May 11 14:40:45 2007
@@ -173,6 +173,7 @@
 'LBL_KINDLY_UPLOAD' => 'Please configure <font color="red">upload_tmp_dir</font> variable in php.ini file.',
 'LBL_EXCEED_MAX' => 'Sorry, the uploaded file exceeds the maximum filesize limit. Please try a file smaller than ',
 'LBL_BYTES' => ' bytes',
+'LBL_CHECK_USER_MAILID' => 'Please check the current user mailid.It should be a valid mailid to send Emails',
 
 );
 

Modified: vtigercrm/branches/5.0.3/modules/Emails/mailsend.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/mailsend.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/mailsend.php Fri May 11 14:40:45 2007
@@ -8,7 +8,6 @@
  * All Rights Reserved.
  ********************************************************************************/
 
-include("modules/Emails/mail.php");
 require_once("include/utils/GetGroupUsers.php");
 require_once("include/utils/UserInfoUtil.php");
 
@@ -74,7 +73,7 @@
 	$query1 = "select email1 from vtiger_users where id =".$current_user->id;
 	$res1 = $adb->query($query1);
 	$val = $adb->query_result($res1,0,"email1");
-	$mail_status = send_mail('Emails',$to_email,$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$cc,$bcc,'all',$focus->id);
+//	$mail_status = send_mail('Emails',$to_email,$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$cc,$bcc,'all',$focus->id);
 	
 	$query = 'update vtiger_emaildetails set email_flag ="SENT",from_email ='."'$val'".' where emailid='.$focus->id;
 	$adb->query($query);
@@ -106,18 +105,6 @@
 	$realid=explode("@",$myids[$i]);
 	$nemail=count($realid);
 	$mycrmid=$realid[0];
-	if($realid[1] == -1)
-	{
-		//handle the mail send to vtiger_users
-		$emailadd = $adb->query_result($adb->query("select email1 from vtiger_users where id=$mycrmid"),0,'email1');
-		$pmodule = 'Users';
-		$description = getMergedDescription($focus->column_fields['description'],$mycrmid,$pmodule);
-		$mail_status = send_mail('Emails',$emailadd,$current_user->user_name,'',$focus->column_fields['subject'],$description,'','','all',$focus->id);
-		$all_to_emailids []= $emailadd;
-		$mail_status_str .= $emailadd."=".$mail_status."&&&";
-	}
-	else
-	{
 		//Send mail to vtiger_account or lead or contact based on their ids
 		$pmodule=getSalesEntityType($mycrmid);
 		for ($j=1;$j<$nemail;$j++)
@@ -166,7 +153,6 @@
 				}
 			}
 		}	
-	}
 
 }
 //Added to redirect the page to Emails/EditView if there is an error in mail sending

Modified: vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php (original)
+++ vtigercrm/branches/5.0.3/modules/Emails/webmailsend.php Fri May 11 14:40:45 2007
@@ -9,7 +9,6 @@
  ********************************************************************************/
 require_once("modules/Emails/mail.php");
 
-$mail_status = send_mail('Emails',$current_user->column_fields['email1'],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],'','','all',$focus->id);
 $mail_status = send_mail('Emails',$_REQUEST["parent_name"],$current_user->user_name,'',$_REQUEST['subject'],$_REQUEST['description'],$_REQUEST["ccmail"],$_REQUEST["bccmail"],'all',$focus->id);
 	
 $query = 'update vtiger_emaildetails set email_flag ="SENT" where emailid='.$focus->id;





More information about the vtigercrm-commits mailing list