0

I'm using Laravel 9 with Laravel Mailables. When I create an appointment, an email will be sent with a date and time value. The email content has a Google Calendar widget (I'm using spatie/icalendar). When the client clicks on the 'add to calendar' link, they can add it. But, when they do that, I want to send a notification mail to the organizer. How can I do that?

Mailable Page

$calendar = Calendar::create('Laracon online')
    ->event(Event::create($this->data['sub'])
        ->organizer('oguzhansade1@gmail.com', $this->data['companyName'])
        ->attendee($this->data['email'])
        ->startsAt(new DateTime($this->data['appDate'][0]['date'].' 
            '.$this->data['appDate'][0]['time'],
            new DateTimeZone('Europe/Istanbul')))
        ->endsAt(new DateTime($this->data['appDate'][0]['date']))

    );


return $this->view('email')
    ->subject($this->data['sub'])
    ->from($this->data['from'], $this->data['companyName'])
    ->with('data', $this->data)
    ->attachData($calendar->get(), 'invite.ics', [
        'mime' => 'text/calendar; charset=UTF-8; method=oguzhansade1@gmail.com',
    ]);

And This is the .ics file.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:spatie/icalendar-generator
NAME:Laracon online
X-WR-CALNAME:Laracon online
BEGIN:VTIMEZONE
TZID:Europe/Istanbul
BEGIN:STANDARD
DTSTART:20220108T040400Z
TZOFFSETFROM:+0300
TZOFFSETTO:+0300
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:UTC
BEGIN:STANDARD
DTSTART:20220106T110129Z
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:633ac10997915
DTSTAMP:20221003T110129Z
SUMMARY:Keşif Randevunuz Düzenlendi
ORGANIZER;CN=Camdalio:MAILTO:oguzhansade1@gmail.com
ATTENDEE:MAILTO:oguzhansade@gmail.com
DTSTART;TZID=Europe/Istanbul:20221005T040400
DTEND:20221005T000000Z
END:VEVENT
END:VCALENDAR
Karl Hill
  • 12,937
  • 5
  • 58
  • 95

0 Answers0