Django:将ICS文件附加到会议响应

时间:2018-09-17 15:29:34

标签: django icalendar email-attachments django-email

我正在尝试将ICS文件附加到通过Django发送的电子邮件中,该电子邮件在接收时包括Outlook中的接受,暂定,拒绝,提议新时间的选项。

meeting-response

当前,我可以将ICS文件附加到电子邮件中,但是它没有提供我上面所述的选项。

ics attachment

以下是我处理ICS文件,附加文件并发送电子邮件的方式:

    #OPEN 'invite.ics' write generated ICS to file
    f = open(os.path.dirname(os.path.realpath(__file__)) + '/attachments/invite.ics', 'w')
    f.write(ical)
    f.close()

    #COMPOSE EMAIL
    msg = EmailMultiAlternatives(subject, description, fro, attendees)


    #Attach ICS file 
    msg.attach_file(os.path.dirname(os.path.realpath(__file__)) + '/attachments/invite.ics')

    #for HTML email template 
    msg.attach_alternative(html_message, "text/html")
    msg.send()

1 个答案:

答案 0 :(得分:0)

您似乎缺少适当的内容类型,而其METHOD指示了iTIP消息的类型。参见Multipart email with text and calendar: Outlook doesn't recognize ics

相关问题