fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [13723] controller: Add an iCal-event if there is a s


From: Sigurd Nes
Subject: [Fmsystem-commits] [13723] controller: Add an iCal-event if there is a serie - and the checklist is visited the first time - or assigned is changed
Date: Sat, 15 Aug 2015 17:19:12 +0000

Revision: 13723
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13723
Author:   sigurdne
Date:     2015-08-15 17:19:11 +0000 (Sat, 15 Aug 2015)
Log Message:
-----------
controller: Add an iCal-event if there is a serie - and the checklist is 
visited the first time - or assigned is changed

Modified Paths:
--------------
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.uicheck_list.inc.php
    trunk/phpgwapi/inc/class.mailer_smtp.inc.php
    trunk/phpgwapi/inc/class.send.inc.php

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2015-08-15 08:48:04 UTC 
(rev 13722)
+++ trunk/controller/inc/class.socontrol.inc.php        2015-08-15 17:19:11 UTC 
(rev 13723)
@@ -1644,4 +1644,53 @@
                        }
                        return $this->db->transaction_commit();
                }
+               function get_serie($serie_id)
+               {
+                       $serie_id = (int) $serie_id;
+                       $serie = array();
+                       $sql = "SELECT controller_control_component_list.* ,"
+                       . " controller_control.title, 
controller_control.enabled as control_enabled,"
+                       . " controller_control_component_list.enabled as 
relation_enabled,"
+                       . " controller_control_serie.enabled as serie_enabled,"
+                       . " controller_control_serie.id as serie_id,"
+                       . " 
controller_control_serie.assigned_to,controller_control_serie.start_date,"
+                       . " 
controller_control_serie.repeat_type,controller_control_serie.repeat_interval,"
+                       . " 
controller_control_serie.service_time,controller_control_serie.controle_time "
+                       . " FROM controller_control_component_list"
+                       . " {$this->db->join} controller_control ON 
controller_control.id = controller_control_component_list.control_id"
+                       . " {$this->db->join} controller_control_serie ON 
(controller_control_component_list.id = 
controller_control_serie.control_relation_id AND 
controller_control_serie.control_relation_type = 'component')"
+                       . " WHERE controller_control_serie.id = {$serie_id}";
+//                     _debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       if ($this->db->next_record())
+                       {
+                               $serie = array
+                               (
+                                       'id'                            => 
$this->db->f('id'),
+                                       'serie_id'                      => 
$this->db->f('serie_id'),
+                                       'control_id'            => 
$this->db->f('control_id'),
+                                       'title'                         => 
$this->db->f('title',true),
+                                       'location_id'           => 
$this->db->f('location_id'),
+                                       'component_id'          => 
$this->db->f('component_id'),
+                                       'assigned_to'           => 
$this->db->f('assigned_to'),
+                                       'start_date'            => 
$this->db->f('start_date'),
+                                       'repeat_type'           => 
$this->db->f('repeat_type'),
+                                       'repeat_interval'       => 
$this->db->f('repeat_interval'),
+                                       'control_enabled'       => 
$this->db->f('control_enabled'),
+                                       'relation_enabled'      => 
$this->db->f('relation_enabled'),
+                                       'serie_enabled'         => 
$this->db->f('serie_enabled'),
+                                       'service_time'          => 
(float)$this->db->f('service_time'),
+                                       'controle_time'         => 
(float)$this->db->f('controle_time'),
+                               );
+                       }
+                       return $serie;
+               }
+               function get_check_list_id_for_deadline($serie_id, $deadline_ts 
= 0)
+               {
+                       $sql = "SELECT id FROM controller_check_list WHERE 
deadline = {$deadline_ts} AND serie_id = ". (int) $serie_id;
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('id');
+               }
        }

Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php     2015-08-15 08:48:04 UTC 
(rev 13722)
+++ trunk/controller/inc/class.uicheck_list.inc.php     2015-08-15 17:19:11 UTC 
(rev 13723)
@@ -226,8 +226,28 @@
                                $type = phpgw::get_var('type');
                                $control_id = phpgw::get_var('control_id');
                                $deadline_ts = phpgw::get_var('deadline_ts');
+                               $deadline_current = 
phpgw::get_var('deadline_current', 'bool');
                                $serie_id = phpgw::get_var('serie_id', 'int');
 
+                               if($deadline_current)
+                               {
+                                       $year = date('Y');
+                                       $month = date('m');
+                                       $a_date = "{$year}-{$month}-23";
+                                       $deadline_ts    = mktime(00, 00, 00, 
$month, date('t', strtotime($a_date)), $year);
+                                       unset($year);
+                                       unset($month);
+                                       unset($a_date);
+
+                                       /*look for checklist with $deadline_ts 
= $deadline_current*/
+
+                                       $check_list_id = 
$this->so_control->get_check_list_id_for_deadline($serie_id, $deadline_ts);
+                                       if($check_list_id)
+                                       {
+                                               
$this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+                                       }
+                               }
+
                                $check_list = new controller_check_list();
                                $check_list->set_control_id($control_id);
                                $check_list->set_deadline($deadline_ts);
@@ -291,8 +311,27 @@
                                $type = "location";
                        }
 
+                       $repeat_descr = '';
+                       if($serie = $this->so_control->get_serie($serie_id))
+                       {
+                               $repeat_type_array = array
+                                       (
+                                               "0"=> lang('day'),
+                                               "1"=> lang('week'),
+                                               "2"=> lang('month'),
+                                               "3"=> lang('year')
+                                       );
+                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                       }
+
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
 
+                       if($repeat_descr)
+                       {
+                               $repeat_descr .= " :: " .$control->get_title();
+                               $control->set_title($repeat_descr);
+                       }
+
                        if(!$responsible_user_id = 
phpgw::get_var('assigned_to', 'int'))
                        {
                                $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
@@ -377,8 +416,27 @@
                                $check_list = 
$this->so->get_single($check_list_id);
                        }
 
+                       $repeat_descr = '';
+                       if($serie = 
$this->so_control->get_serie($check_list->get_serie_id()))
+                       {
+                               $repeat_type_array = array
+                                       (
+                                               "0"=> lang('day'),
+                                               "1"=> lang('week'),
+                                               "2"=> lang('month'),
+                                               "3"=> lang('year')
+                                       );
+                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                       }
+
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
 
+                       if($repeat_descr)
+                       {
+                               $repeat_descr .= " :: " .$control->get_title();
+                               $control->set_title($repeat_descr);
+                       }
+
                        $component_id = $check_list->get_component_id();
 
                        if($component_id > 0)
@@ -691,6 +749,9 @@
                        $check_list->set_deadline($deadline_date_ts);
                        $check_list->set_planned_date($planned_date_ts);
                        $check_list->set_completed_date($completed_date_ts);
+
+                       $orig_assigned_to = $check_list->get_assigned_to();
+
                        $check_list->set_assigned_to($assigned_to);
 
                        $config = CreateObject('phpgwapi.config','controller');
@@ -719,7 +780,72 @@
                        if(!$error && $check_list->validate())
                        {
                                $check_list_id = $this->so->store($check_list);
+                               $serie = 
$this->so_control->get_serie($check_list->get_serie_id());
 
+                               /**
+                                * Add an iCal-event if there is a serie - and 
the checklist is visited the first time - or assigned is changed
+                                */
+                               if(($check_list_id && $serie && 
!phpgw::get_var('check_list_id')) || ($serie && $orig_assigned_to != 
$assigned_to) )
+                               {
+                                       $bocommon= 
CreateObject('property.bocommon');
+                                       $current_prefs_user = 
$bocommon->create_preferences('property',$GLOBALS['phpgw_info']['user']['account_id']);
+                                       $from_address = 
"{$GLOBALS['phpgw_info']['user']['fullname']}<{$current_prefs_user['email']}>";
+                                       $from_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+
+                                       $to_name = 
$GLOBALS['phpgw']->accounts->id2name($assigned_to);
+                                       $prefs_target = 
$bocommon->create_preferences('property',$assigned_to);
+                                       $to_address = $prefs_target['email'];
+
+                                       if(! $start_date = 
$check_list->get_planned_date())
+                                       {
+                                               $start_date = 
$check_list->get_deadline();
+                                       }
+                                       $startTime = $start_date + 8 * 3600;
+
+                                       $endTime = $startTime + ( 
(float)$serie['service_time'] * 3600 ) + ( (float)$serie['controle_time'] * 
3600 );
+
+                                       if($check_list->get_component_id() > 0)
+                                       {
+                                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$check_list->get_location_id(), 'id' => $check_list->get_component_id()));
+                                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+                                               $short_desc = $location_name . 
'::' . execMethod('property.soentity.get_short_description', 
array('location_id' => $check_list->get_location_id(), 'id' => 
$check_list->get_component_id()));
+                                               $location = $location_name;
+                                       }
+
+                                       $repeat_type_array = array
+                                               (
+                                                       "0"=> lang('day'),
+                                                       "1"=> lang('week'),
+                                                       "2"=> lang('month'),
+                                                       "3"=> lang('year')
+                                               );
+
+                                       $subject = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                                       $subject .= 
"::{$serie['title']}::{$short_desc}";
+
+                                       $description = '<a href ="' . 
$GLOBALS['phpgw']->link('/index.php', array(
+                                               'menuaction'    => 
'controller.uicheck_list.add_check_list',
+                                               'control_id'    => 
$check_list->get_control_id(),
+                                               'location_id'   => 
$check_list->get_location_id(),
+                                               'component_id'  => 
$check_list->get_component_id(),
+                                               'serie_id'              => 
$check_list->get_serie_id(),
+                                               'type'                  => 
'component',
+                                               'assigned_to'   => 
$check_list->get_assigned_to(),
+                                               'deadline_current'      => true
+
+                                       ),false,true).'">' . lang('serie').' #' 
.$check_list->get_serie_id() .'</a>'."\n";
+
+                                       $description = str_replace('&amp;', 
'&', $description);
+                                       if($from_address && $to_address)
+                                       {
+                                               
$this->sendIcalEvent($from_name, $from_address, $to_name, $to_address, 
$startTime, $endTime, $subject, $description, $location);
+                                       }
+                                       else
+                                       {
+                                               
phpgwapi_cache::message_set("Mangler epostadresse til avsender eller addresat - 
eller begge", 'error');
+                                       }
+                               }
+
                                if($check_list_id > 0)
                                {
                                        $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
@@ -1008,12 +1134,12 @@
 
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-                        
-                        $location_code = $check_list->get_location_code();
-                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                        $level = 
$this->location_finder->get_location_level($location_code);
-                        //var_dump($location_array);
 
+                                                                               
                $location_code = $check_list->get_location_code();
+                                                                               
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
+                                                                               
                $level = 
$this->location_finder->get_location_level($location_code);
+                                                                               
                //var_dump($location_array);
+
                        $saved_groups_with_items_array = array();
 
                        //Populating array with saved control items for each 
group
@@ -1030,9 +1156,9 @@
                        (
                                'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
                                'check_list' => $check_list,
-                                'control' => $control->toArray(),
-                                'location_array' => $location_array,
-                                'location_level' => $level
+                                                                               
                                                'control' => 
$control->toArray(),
+                                                                               
                                                'location_array' => 
$location_array,
+                                                                               
                                                'location_level' => $level
                        );
 
                        
self::render_template_xsl('check_list/print_check_list', $data);
@@ -1261,4 +1387,117 @@
 
                        return $ok;
                }
+
+               /**
+                * 
+                * @param string $from_name
+                * @param string $from_address
+                * @param string $to_name
+                * @param string $to_address
+                * @param int $startTime
+                * @param int $endTime
+                * @param string $subject
+                * @param string $description
+                * @param string $location
+                * @return type
+                */
+               function sendIcalEvent($from_name, $from_address, $to_name, 
$to_address, $startTime, $endTime, $subject, $description, $location)
+               {
+//                     
https://www.exchangecore.com/blog/sending-outlookemail-calendar-events-php/
+
+                       $domain = $GLOBALS['phpgw_info']['server']['hostname'];
+
+                       //Create Email Headers
+                       $mime_boundary = "----Meeting Booking----".md5(time());
+
+                       $headers  = <<<HTML
+                       From: {$from_name} <{$from_address}>
+                       Reply-To: {$from_name} <{$from_address}>
+                       MIME-Version: 1.0
+                       Content-Type: multipart/alternative; 
boundary=\"{$mime_boundary}\"
+                       Content-class: urn:content-classes:calendarmessage
+HTML;
+
+                       //Create Email Body (HTML)
+                       $message  = <<<HTML
+                       --{$mime_boundary}
+                       Content-Type: text/html; charset=UTF-8
+                       Content-Transfer-Encoding: 8bit
+
+                       <html>
+                       <body>
+                       <p>Dear {$to_name}</p>
+                       <p>{$description}</p>
+                       </body>
+                       </html>
+                       --{$mime_boundary}
+
+
+HTML;
+                       $last_modified =  date("Ymd\TGis");
+                       $uid = date("Ymd\TGis", $startTime).rand()."@".$domain;
+                       $dtstamp = date("Ymd\TGis");
+                       $dtstart = date("Ymd\THis", $startTime);
+                       $dtend = date("Ymd\THis", $endTime);
+                       $timezone = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['timezone'];
+
+
+$ical = <<<HTML
+BEGIN:VCALENDAR
+PRODID:controller
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+X-WR-TIMEZONE:Europe/Oslo
+BEGIN:VEVENT
+ORGANIZER;CN="{$to_name}":MAILTO:{$to_address}
+ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
+DTSTAMP:{$dtstamp}
+DTSTART:{$dtstart}
+DTEND:{$dtend}
+SEQUENCE:0
+STATUS:TENTATIVE
+SUMMARY:{$subject}
+LOCATION:{$location}
+DESCRIPTION:{$description}
+UID:{$uid}
+BEGIN:VALARM
+TRIGGER:-PT15M
+ACTION:DISPLAY
+DESCRIPTION:Reminder
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+HTML;
+
+//ORGANIZER;CN="{$from_name}":MAILTO:{$from_address}
+//ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
+
+
+
+                       $message .= $ical;
+
+                       $rc = false;
+                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                       {
+                               $send= CreateObject('phpgwapi.send');
+                               try
+                               {
+                                       $rc = $send->msg('email', $to_address, 
$subject, $message, $msgtype='Ical', $cc='', $bcc='', $from_address, 
$from_name,'html',$mime_boundary);
+                               }
+                               catch (phpmailerException $e)
+                               {
+                                       
phpgwapi_cache::message_set($e->getMessage(), 'error');
+                               }
+                       }
+                       else
+                       {
+                               phpgwapi_cache::message_set(lang('SMTP server 
is not set! (admin section)'), 'error');
+                       }
+
+
+               //      $mailsent = mail($to_address, $subject, $message, 
$headers);
+
+                       return $rc;
+               }
        }

Modified: trunk/phpgwapi/inc/class.mailer_smtp.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.mailer_smtp.inc.php        2015-08-15 08:48:04 UTC 
(rev 13722)
+++ trunk/phpgwapi/inc/class.mailer_smtp.inc.php        2015-08-15 17:19:11 UTC 
(rev 13723)
@@ -13,6 +13,7 @@
        * @see phpmailer
        */
        require_once PHPGW_INCLUDE_ROOT . 
'/phpgwapi/inc/phpmailer/class.phpmailer.php';
+       require_once PHPGW_INCLUDE_ROOT . 
'/phpgwapi/inc/phpmailer/PHPMailerAutoload.php';
        
        /**
        * Send email messages via SMTP

Modified: trunk/phpgwapi/inc/class.send.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.send.inc.php       2015-08-15 08:48:04 UTC (rev 
13722)
+++ trunk/phpgwapi/inc/class.send.inc.php       2015-08-15 17:19:11 UTC (rev 
13723)
@@ -34,7 +34,7 @@
                        $this->err['desc'] = ' ';
                }
 
-               function msg($service, $to, $subject, $body, $msgtype='', 
$cc='', $bcc='', $from='', $sender='', $content_type='', 
$boundary='Message-Boundary',$attachments=array(), $receive_notification = 
false)
+               function msg($service, $to, $subject, $body, $msgtype='', 
$cc='', $bcc='', $from='', $sender='', $content_type='', 
$boundary='',$attachments=array(), $receive_notification = false)
                {
                        if (!$from)
                        {
@@ -62,37 +62,27 @@
                        switch( $service )
                        {
                                case 'email':
-                                       return $this->send_email($to, $subject, 
$body, $msgtype, $cc, $bcc, $from, $sender, $content_type, 
$boundary='Message-Boundary', $attachments, $receive_notification);
+                                       return $this->send_email($to, $subject, 
$body, $msgtype, $cc, $bcc, $from, $sender, $content_type, $boundary, 
$attachments, $receive_notification);
                                        break;
                        }
                }
 
-               function send_email($to, $subject, $body, $msgtype, $cc, $bcc, 
$from, $sender, $content_type, $ignored,$attachments, $receive_notification)
+               function send_email($to, $subject, $body, $msgtype, $cc, $bcc, 
$from, $sender, $content_type, $boundary,$attachments, $receive_notification)
                {
-                       $smtp = createObject('phpgwapi.mailer_smtp');
+                       $mail = createObject('phpgwapi.mailer_smtp');
                        $from = 
str_replace(array('[',']'),array('<','>'),$from);
                        $from_array = split('<', $from);
                        unset($from);
                        if ( count($from_array) == 2 )
                        {
-                               $smtp->From = trim($from_array[1],'>');
-                               $smtp->FromName = $from_array[0];
+                               $mail->From = trim($from_array[1],'>');
+                               $mail->FromName = $from_array[0];
                        }
                        else
                        {
-                               $smtp->From = $from_array[0];
-                               $smtp->FromName = $sender;
+                               $mail->From = $from_array[0];
+                               $mail->FromName = $sender;
                        }
-/*                     
-                       if(strpos($to,','))
-                       {
-                               $delimiter = ',';
-                       }
-                       else
-                       {
-                               $delimiter = ';';
-                       }
-*/
                        $delimiter = ';';
                        $to = explode($delimiter, $to);
                        
@@ -102,26 +92,16 @@
                                $to_array = split('<', $entry);
                                if ( count($to_array) == 2 )
                                {
-                                       
$smtp->AddAddress(trim($to_array[1],'>'), $to_array[0]);
+                                       
$mail->AddAddress(trim($to_array[1],'>'), $to_array[0]);
                                }
                                else
                                {
-                                       $smtp->AddAddress($to_array[0]);
+                                       $mail->AddAddress($to_array[0]);
                                }
                        }
 
                        if($cc)
                        {
-/*
-                               if(strpos($cc,','))
-                               {
-                                       $delimiter = ',';
-                               }
-                               else
-                               {
-                                       $delimiter = ';';
-                               }
-*/
                                $delimiter = ';';
                                $cc = explode($delimiter, $cc);
                        
@@ -131,26 +111,16 @@
                                        $cc_array = split('<', $entry);
                                        if ( count($cc_array) == 2 )
                                        {
-                                               
$smtp->AddCC(trim($cc_array[1],'>'), $cc_array[0]);
+                                               
$mail->AddCC(trim($cc_array[1],'>'), $cc_array[0]);
                                        }
                                        else
                                        {
-                                               $smtp->AddCC($cc_array[0]);
+                                               $mail->AddCC($cc_array[0]);
                                        }
                                }
                        }
                        if($bcc)
                        {
-/*
-                               if(strpos($bcc,','))
-                               {
-                                       $delimiter = ',';
-                               }
-                               else
-                               {
-                                       $delimiter = ';';
-                               }
-*/
                                $delimiter = ';';
                                $bcc = explode($delimiter, $bcc);
                        
@@ -160,38 +130,58 @@
                                        $bcc_array = split('<', $entry);
                                        if ( count($bcc_array) == 2 )
                                        {
-                                               
$smtp->AddBCC(trim($bcc_array[1],'>'), $bcc_array[0]);
+                                               
$mail->AddBCC(trim($bcc_array[1],'>'), $bcc_array[0]);
                                        }
                                        else
                                        {
-                                               $smtp->AddBCC($bcc_array[0]);
+                                               $mail->AddBCC($bcc_array[0]);
                                        }
                                }
                        }
-                       $smtp->IsSMTP();
-                       $smtp->Subject = $subject;
-                       $smtp->Body    = $body;
-                       $smtp->AddCustomHeader('X-Mailer: fmsystem 
(http://www.fmsystem.no)');
+                       $mail->IsSMTP();
+                       $mail->Subject = $subject;
+                       $mail->Body    = $body;
+                       $mail->addCustomHeader('X-Mailer: fmsystem 
(http://www.fmsystem.no)');
                        if($receive_notification)
                        {
-                               
$smtp->AddCustomHeader("Disposition-Notification-To: {$smtp->From}");
+                               
$mail->addCustomHeader("Disposition-Notification-To: {$mail->From}");
                        }
 
                        if($content_type =='html')
                        {
-                               $smtp->IsHTML(true);
+                               $mail->IsHTML(true);
                        }
                        else
                        {
-                               $smtp->IsHTML(false);
-                               $smtp->WordWrap = 76;
+                               $mail->IsHTML(false);
+                               $mail->WordWrap = 76;
                        }
 
+                       switch($msgtype)
+                       {
+                               case 'Ical':
+                                       $mail->Ical = true;
+                                       $mail->ContentType = 'text/calendar';
+                                       
$mail->addCustomHeader('MIME-version',"1.0");
+                                       if($boundary)
+                                       {
+                                               
$mail->addCustomHeader('Content-type',"multipart/alternative; 
boundary=\"{$boundary}\"");
+                                       }
+                                       
$mail->addCustomHeader('Content-type',"text/calendar; method=REQUEST; 
charset=UTF-8");
+                                       
$mail->addCustomHeader('Content-Transfer-Encoding',"8bit");
+                                       
$mail->addCustomHeader('X-Mailer',"Microsoft Office Outlook 12.0");
+                                       $mail->addCustomHeader("Content-class: 
urn:content-classes:calendarmessage");
+                                       break;
+
+                               default:
+                                       break;
+                       }
+
                        if($attachments && is_array($attachments))
                        {
                                foreach($attachments as $key => $value)
                                {
-                                       $smtp->AddAttachment
+                                       $mail->AddAttachment
                                        (
                                                $value['file'],
                                                utf8_decode($value['name']),
@@ -203,14 +193,14 @@
 
                        // set a higher timeout for big messages
                        @set_time_limit(120);
-                       #$smtp->SMTPDebug = 10;
+                       #$mail->SMTPDebug = 10;
                        try
                        {
-                               $smtp->Send();
+                               $mail->Send();
                        }
                        catch (phpmailerException $e)
                        {
-                               $this->errorInfo = $smtp->ErrorInfo;
+                               $this->errorInfo = $mail->ErrorInfo;
                                throw $e;
                                return false;
                        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]