开发者

Emailing guests while creating new event using google Data API for google calendar

开发者 https://www.devze.com 2023-03-12 07:11 出处:网络
I am building an event management web application in PHP and am using Google Data API to make use of google calendar.

I am building an event management web application in PHP and am using Google Data API to make use of google calendar.

I have added guests us开发者_开发知识库ing:

$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->who=array($gc->newWho('abc@gmail.com'));

I want to send mails to the guests added to notify them of the event.(This feature is there in the Google Calendar UI).

How can I do this?


This might be helpful:

public function sendInvite($eventId, $email)
{
    $gdataCal = new Zend_Gdata_Calendar($this->client);

    if($eventOld = $this->getEvent($eventId))
    {
        $SendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); 
        $SendEventNotifications->setValue(true); 
        $eventOld->SendEventNotifications = $SendEventNotifications;
        $who = $gdataCal->newwho();
        $who->setEmail($email);

        $eventOld->setWho(array_merge(array($who), $eventOld->getWho())); 

        try
        {
            $eventOld->save();
        } catch(Zend_Gdata_App_Exception $e)
        {
            return false;
        }

        return true;
    } else
        return false;
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消