简体   繁体   English

使用 google 数据 API for google calendar 创建新活动时向客人发送电子邮件

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

I am building an event management web application in PHP and am using Google Data API to make use of google calendar.我正在 PHP 中构建事件管理 web 应用程序,并且正在使用 Google 数据 API 来使用 Google 日历。

I have added guests using:我使用以下方法添加了客人:

$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).我想向添加的客人发送邮件以通知他们该事件。(此功能在 Google 日历 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;
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM