正在发送 Google 日历 API 确认邮件
Sending Google Calendar API Confirmation email
我正在尝试做到这一点,以便在使用 Google 日历 API 创建活动并添加参与者后,他们将收到一封确认电子邮件。
当前的 Google 日历 API 是否可行? (我在后端使用 PHP)。我尝试将 sendUpdates
设置为全部,将 attendees[].responseStatus
设置为 needsAction
,但没有成功。
$event = new Google_Service_Calendar_Event(array(
'summary' =>'something',
'location' => 'something',
'description' => $name.' test',
'start' => array(
// 'dateTime' => '2015-05-28T09:00:00-07:00',
'dateTime' => $start.':00-04:00',
'timeZone' => 'America/Toronto',
),
'end' => array(
'dateTime' => $end.':00-04:00',
'timeZone' => 'America/Toronto',
),
'attendees' => array(
array('email' => $email),
'responseStatus' => 'needsAction',
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
'sendUpdates' => 'all',
'visibility' => 'public',
));
$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event);
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>";
提前致谢
sendUpdates
是请求参数,不是请求体的选项
换句话说,它不在请求体中。
修改您的代码如下:
$event = new Google_Service_Calendar_Event(array(
'summary' =>'something',
'location' => 'something',
'description' => $name.' test',
'start' => array(
// 'dateTime' => '2015-05-28T09:00:00-07:00',
'dateTime' => $start.':00-04:00',
'timeZone' => 'America/Toronto',
),
'end' => array(
'dateTime' => $end.':00-04:00',
'timeZone' => 'America/Toronto',
),
'attendees' => array(
array('email' => $email),
'responseStatus' => 'needsAction',
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
'visibility' => 'public',
));
$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event, array('sendUpdates' => 'all'));
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>";
我正在尝试做到这一点,以便在使用 Google 日历 API 创建活动并添加参与者后,他们将收到一封确认电子邮件。
当前的 Google 日历 API 是否可行? (我在后端使用 PHP)。我尝试将 sendUpdates
设置为全部,将 attendees[].responseStatus
设置为 needsAction
,但没有成功。
$event = new Google_Service_Calendar_Event(array(
'summary' =>'something',
'location' => 'something',
'description' => $name.' test',
'start' => array(
// 'dateTime' => '2015-05-28T09:00:00-07:00',
'dateTime' => $start.':00-04:00',
'timeZone' => 'America/Toronto',
),
'end' => array(
'dateTime' => $end.':00-04:00',
'timeZone' => 'America/Toronto',
),
'attendees' => array(
array('email' => $email),
'responseStatus' => 'needsAction',
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
'sendUpdates' => 'all',
'visibility' => 'public',
));
$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event);
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>";
提前致谢
sendUpdates
是请求参数,不是请求体的选项
换句话说,它不在请求体中。
修改您的代码如下:
$event = new Google_Service_Calendar_Event(array(
'summary' =>'something',
'location' => 'something',
'description' => $name.' test',
'start' => array(
// 'dateTime' => '2015-05-28T09:00:00-07:00',
'dateTime' => $start.':00-04:00',
'timeZone' => 'America/Toronto',
),
'end' => array(
'dateTime' => $end.':00-04:00',
'timeZone' => 'America/Toronto',
),
'attendees' => array(
array('email' => $email),
'responseStatus' => 'needsAction',
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
'visibility' => 'public',
));
$calendarId = 'vladc99@gmail.com';
$event = $service->events->insert($calendarId, $event, array('sendUpdates' => 'all'));
echo "<a href='".$event->htmlLink."' taget='_blank'> Click here </a>";
echo "<a href='../'>Home</a>";