46
loading...
This website collects cookies to deliver better user experience
🇨🇿 V češtině si lze článek přečíst na kutac.cz
*.ics
) file. However, it must satisfy a few easy requirements:*.ics
file with all information about the event.*.ics
file must contain property METHOD:REQUEST
.method=REQUEST
part.Attendee
property must be part of the body of iCal file and must contain the email address of the recipient.use Carbon\Carbon;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Spatie\IcalendarGenerator\Components\Calendar;
use Spatie\IcalendarGenerator\Components\Event;
use Spatie\IcalendarGenerator\Properties\TextProperty;
class EventCreatedNotification extends Notification
{
// ...
public function toMail(): MailMessage
{
$calendar = Calendar::create()
->productIdentifier('Kutac.cz')
->event(function (Event $event) {
$event->name("Email with iCal 101")
->attendee("[email protected]")
->startsAt(Carbon::parse("2021-12-15 08:00:00"))
->endsAt(Carbon::parse("2021-12-19 17:00:00"))
->fullDay()
->address('Online - Google Meet');
});
$calendar->appendProperty(TextProperty::create('METHOD', 'REQUEST'));
return (new MailMessage())
->subject("Invitation")
->markdown('mail.invite.created')
->attachData($calendar->get(), 'invite.ics', [
'mime' => 'text/calendar; charset=UTF-8; method=REQUEST',
]);
}
}
->organizer()
part, and on purpose. When the organizer is specified, email clients are sending emails when the user accepts or declines the invitation. So it can spam the organizer mailbox. Especially when the system is sending hundreds of emails.*.ics
file. But instead of REQUEST method, it has method=REPLY
in the Content-Type and METHOD:REPLY
inside the body of the file.