[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 //////////////////////////////////////////////////// 3 // PHPMailer - PHP email class 4 // 5 // Class for sending email using either 6 // sendmail, PHP mail(), or SMTP. Methods are 7 // based upon the standard AspEmail(tm) classes. 8 // 9 // Copyright (C) 2001 - 2003 Brent R. Matzelle 10 // 11 // License: LGPL, see LICENSE 12 //////////////////////////////////////////////////// 13 14 /** 15 * PHPMailer - PHP email transport class 16 * @package PHPMailer 17 * @author Brent R. Matzelle 18 * @copyright 2001 - 2003 Brent R. Matzelle 19 */ 20 21 22 require_once ('include/utils/utils.php'); 23 require ("modules/Emails/mail.php"); 24 require_once ('include/logging.php'); 25 require ("config.php"); 26 27 28 global $adb; 29 global $log; 30 global $HELPDESK_SUPPORT_EMAIL_ID,$HELPDESK_SUPPORT_NAME; 31 $log =& LoggerManager::getLogger('SendSupportNotification'); 32 $log->debug(" invoked SendSupportNotification "); 33 34 // retrieve the translated strings. 35 $app_strings = return_application_language($current_language); 36 37 38 //To send email notification before a week 39 $query="select vtiger_contactdetails.contactid,vtiger_contactdetails.email,vtiger_contactdetails.firstname,vtiger_contactdetails.lastname,contactid from vtiger_customerdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_customerdetails.customerid inner join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_customerdetails.customerid where vtiger_crmentity.deleted=0 and support_end_date=DATE_ADD(now(), INTERVAL 1 WEEK)"; 40 $result = $adb->pquery($query, array()); 41 42 43 if($adb->num_rows($result) >= 1) 44 { 45 while($result_set = $adb->fetch_array($result)) 46 { 47 48 $content=getcontent_week($result_set["contactid"]); 49 $body=$content["body"]; 50 $body = str_replace('$logo$','<img src="cid:logo" />',$body); 51 $subject=$content["subject"]; 52 53 $status=send_mail("Support",$result_set["email"],$HELPDESK_SUPPORT_NAME,$HELPDESK_SUPPORT_EMAIL_ID,$subject,$body,'',$HELPDESK_SUPPORT_EMAIL_ID 54 ); 55 56 } 57 58 } 59 //comment / uncomment this line if you want to hide / show the sent mail status 60 //showstatus($status); 61 $log->debug(" Send Support Notification Befoe a week - Status: ".$status); 62 63 //To send email notification before a month 64 $query="select vtiger_contactdetails.contactid,vtiger_contactdetails.email,vtiger_contactdetails.firstname,vtiger_contactdetails.lastname,contactid from vtiger_customerdetails inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_customerdetails.customerid inner join vtiger_contactdetails on vtiger_contactdetails.contactid=vtiger_customerdetails.customerid where vtiger_crmentity.deleted=0 and support_end_date=DATE_ADD(now(), INTERVAL 1 MONTH)"; 65 $result = $adb->pquery($query, array()); 66 67 68 if($adb->num_rows($result) >= 1) 69 { 70 while($result_set = $adb->fetch_array($result)) 71 { 72 $content=getcontent_month($result_set["contactid"]); 73 $body=$content["body"]; 74 $body = str_replace('$logo$','<img src="cid:logo" />',$body); 75 $subject=$content["subject"]; 76 77 $status=send_mail("Support",$result_set["email"],$HELPDESK_SUPPORT_NAME,$HELPDESK_SUPPORT_EMAIL_ID,$subject,$body,'',$HELPDESK_SUPPORT_EMAIL_ID); 78 } 79 80 } 81 82 //comment / uncomment this line if you want to hide / show the sent mail status 83 //showstatus($status); 84 $log->debug(" Send Support Notification Befoe a Month - Status: ".$status); 85 86 //used to dispaly the sent mail status 87 function showstatus($status) 88 { 89 90 if($status == 1) 91 echo "Mails sent successfully"; 92 else if($status == "") 93 echo "No contacts matched"; 94 else 95 echo "Error while sending mails: ".$status; 96 } 97 98 99 100 //function used to get the header and body content of the mail to be sent. 101 function getcontent_month($id) 102 { 103 global $adb; 104 $query='select vtiger_emailtemplates.subject,vtiger_emailtemplates.body from vtiger_notificationscheduler inner join vtiger_emailtemplates on vtiger_emailtemplates.templateid=vtiger_notificationscheduler.notificationbody where schedulednotificationid=7'; 105 $result = $adb->pquery($query, array()); 106 $body=$adb->query_result($result,0,'body'); 107 $body=getMergedDescription($body,$id,"Contacts"); 108 $body=getMergedDescription($body,$id,"Users"); 109 $res_array["subject"]=$adb->query_result($result,0,'subject'); 110 $res_array["body"]=$body; 111 return $res_array; 112 113 } 114 115 //function used to get the header and body content of the mail to be sent. 116 function getcontent_week($id) 117 { 118 global $adb; 119 $query='select vtiger_emailtemplates.subject,vtiger_emailtemplates.body from vtiger_notificationscheduler inner join vtiger_emailtemplates on vtiger_emailtemplates.templateid=vtiger_notificationscheduler.notificationbody where schedulednotificationid=6'; 120 $result = $adb->pquery($query, array()); 121 $body=$adb->query_result($result,0,'body'); 122 $body=getMergedDescription($body,$id,"Contacts"); 123 $body=getMergedDescription($body,$id,"Users"); 124 $res_array["subject"]=$adb->query_result($result,0,'subject'); 125 $res_array["body"]=$body; 126 return $res_array; 127 128 } 129 130 131 132 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |