Index: /branches/2.2.0.1/phpgwapi/inc/class.phpmailer.inc.php
===================================================================
--- /branches/2.2.0.1/phpgwapi/inc/class.phpmailer.inc.php	(revision 2)
+++ /branches/2.2.0.1/phpgwapi/inc/class.phpmailer.inc.php	(revision 4138)
@@ -234,4 +234,11 @@
      * @return void
      */
+    function Iscalendar($bool) {
+        if($bool == true)
+            $this->ContentType = "multipart/alternative;\n  boundary=\"01BD3665.3AF0D360\"\n";
+        else 
+            $this->ContentType = "text/plain";
+    }
+
     function IsHTML($bool) {
         if($bool == true)
Index: /branches/2.2.0.1/calendar/inc/class.bocalendar.inc.php
===================================================================
--- /branches/2.2.0.1/calendar/inc/class.bocalendar.inc.php	(revision 3998)
+++ /branches/2.2.0.1/calendar/inc/class.bocalendar.inc.php	(revision 4138)
@@ -3015,4 +3015,6 @@
 				return null;
 
+                        $sender = $GLOBALS['phpgw_info']['user']['email'];
+                        $uid_dono = $GLOBALS['phpgw_info']['user']['account_lid'];
 			$tmpattach="BEGIN:VCALENDAR\n"
 			."PRODID:-//Expresso Livre//Calendar//EN\n"
@@ -3040,9 +3042,44 @@
 				."DTEND:".$end_time."\r\n"
 				."LAST-MODIFIED:".gmdate("Ymd\THis\Z")."\r\n" //Hora no formato UTC
-				."UID:Expresso-".$event['id'].$event['uid']."\r\n"
+				//."UID:Expresso-".$event['id'].$event['uid']."\r\n"
+                                ."UID:Expresso-".$event[id]."@".$uid_dono."\n"
 				."DESCRIPTION:".$description."\r\n"
 				."SUMMARY:".$event['title']."\r\n"
 				."LOCATION:".$event['location']."\r\n"
-				."END:VEVENT\r\n";
+				."ORGANIZER:mailto:".$sender."\n";
+                                $expart=preg_split('/,/', $event['ex_participants']);
+
+                                foreach ($expart as $mail)
+                                {
+                                    if($mail != "")
+                                    {
+                                        $tmpattach.="ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:".$mail."\n";
+                                    }
+                                }
+                                
+                                while (list($id,$status) = each($event['participants']))
+                                {
+
+                                      $preferences = CreateObject('phpgwapi.preferences',$id);
+                                      $mail = $preferences->email_address($id);
+                                      if ( $sender != $mail)
+                                      {
+                                         if($status == 'U' ){
+                                                  $tmpattach.="ATTENDEE;RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:mailto:".$mail."\n";
+                                                        }
+                                         elseif($status == 'A' ){
+                                                 $tmpattach.="ATTENDEE;RSVP=TRUE;PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:mailto:".$mail."\n";
+                                                        }
+                                         elseif($status == 'T' ){
+                                                 $tmpattach.="ATTENDEE;RSVP=TRUE;PARTSTAT=TENTATIVE;ROLE=REQ-PARTICIPANT:mailto:".$mail."\n";
+                                                         }
+                                         else
+                                                  {
+                                                     $tmpattach.="ATTENDEE;RSVP=TRUE;PARTSTAT=DECLINED;ROLE=REQ-PARTICIPANT:mailto:".$mail."\n";
+                                                   }
+                                      }
+                                }
+                                $tmpattach.="END:VEVENT"."\n";
+                                //."END:VEVENT\r\n";
 			}
                     $tmpattach.="END:VCALENDAR\r\n";
@@ -3201,5 +3238,6 @@
 			$mail->From = $GLOBALS['phpgw']->preferences->values['email'];
 			$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
-			$mail->IsHTML(true);
+			//$mail->IsHTML(true);
+                        $mail->IsCalendar(true);
 
 			// Aqui e enviado o email
@@ -3462,6 +3500,16 @@
 					}
 					$mail->AddAddress($to);
-					$mail->Body = $tmpbody;
-					$mail->From = $sender;
+					//$mail->Body = $tmpbody;
+                                        $tmpattach_n = $this->create_vcard($GLOBALS['bocalendar']->so->cal->event);
+                                        $tmpattach = str_replace("Expresso-","",$tmpattach_n);
+                                        $mail->Body = "This is a multi-part message in MIME format.";
+                                        $mail->Body .= "\n--01BD3665.3AF0D360\n";
+                                        $mail->Body .= "Content-Type: text/html; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: 8bit\n";
+                                        $mail->Body .= $tmpbody;
+                                        $mail->Body .= "\n--01BD3665.3AF0D360\n";
+                                        $mail->Body .="Content-Type:text/calendar; method=REQUEST; charset=US-ASCII\nContent-Transfer-Encoding:7bit\n\n";
+                                        $mail->Body .= $tmpattach;
+                                        $mail->Body .= "\n--01BD3665.3AF0D360--\n";
+                                        $mail->From = $sender;
 					$mail->FromName = $GLOBALS['phpgw_info']['user']['fullname'];
 					$mail->Sender = $mail->From;
@@ -3494,4 +3542,5 @@
 				$mail->ClearAllRecipients();
 				$var = explode(",",trim($this->ex_participants));
+                                $mail->IsHTML(true);
 				$to = array();
 				if(!$subject) {
