My is a simple celery asyncronus task which sends email attaching invite.ics file, but i dont know how to pass dynamic context in invite.ics file?
my task file for sending email ->
import os
from django.conf import settings
from celery import shared_task
from time import sleep
from django.core.mail import send_mail
from django.core.mail import EmailMessage
@shared_task
def send_email_with_celery(company, date, sender, receiver):
email = EmailMessage(f'Interview with {company}', f'You have been selected for the interview at time {date}', f"{sender} from {company}", [f'{receiver}'])
email.attach_file('invite.ics', 'text/calendar')
email.send()
return None
my invite.ics file-->
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:{{ sender }} <-- dynamic sender context
DTSTAMP:19970714T170000Z
ORGANIZER;CN=Sonu Sud:MAILTO:{{ receiver }} <-- dynamic reciever context
DTSTART:20201005T110000Z <-- should be dynamic time value in this format
DTEND:20201005T114500Z <-- should be dynamic time value in this format
SUMMARY:Interview with {{ company }} <-- should be dynamic Company name
GEO:48.85299;2.36885
END:VEVENT
END:VCALENDAR
i want to pass the context like this ->
context = {
"sender":,
"receiver":,
"start":,
"end":,
"company":
}
how to pass the context in invite.ics file...?