The task: To create an email that can result in a calendar entry being created in the recipient's calendar. The same email should work for either a Lotus Notes or Outlook client. The code will be in a LotusScript agent called by the WebQuerySave event on a intranet-based Lotus Notes form (ie. the code runs on the Domino 9 server using the logged-in user's credentials).
It is ok if the user has to click on something in the email to get it to create a calendar entry.
Ideally: I would like to be able to create the MIME content directly without having to mess around with creating ics file attachments, due to restrictive security on the server making it problematic to be creating and removing temp files. Likewise if possible I'd like to avoid 3rd party plug-ins due to the approval process for such things.
I've tried: A few different combinations of writing MIME entries with minor success in the Notes client but no success thus far in the Outlook client. I know what the resulting MIME message should look like (by sending a regular calendar entry created in Lotus Notes to a Thunderbird client and using Ctrl-U to view the source), and I can emulate that, but I've been unable to send that in such a way as it doesn't get scrambled by the mail router.
I tried creating a MIME stream:
' .. Regular setup code here
Set stream = session.Createstream()
session.ConvertMime = False
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set body = docMemo.Createmimeentity
' .. create subject and To fields in the header entity here
Call stream.Writetext(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' for example:
' This is a multipart message in MIME format.
' --=_mixed 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/related; boundary="=_related 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_related 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: multipart/alternative; boundary="=_alternative 5DB3BEC8067B2AAFCA2582430012A396_="
'
' --=_alternative 5DB3BEC8067B2AAFCA2582430012A396_=
' Content-Type: text/plain; charset=US-ASCII
' Content-Transfer-Encoding: quoted-printable
'
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' Broadcast: Test outlook 3=20=20=20=20=20=20=20=20=20=20=20=
' =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
' etc...
call body.Setcontentfromtext(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT)
Call docMemo.Send(False)
session.Convertmime = True
And I tried putting the MIME-formatted message into a rich text field and converting that to MIME:
' .. Regular setup code here
Set docMemo = db.Createdocument()
docMemo.Form = "Memo"
Set rtiBody = New NotesRichTextItem(docMemo, "Body")
' .. create subject and To fields here
Call rtiBody.AppendText(".. the exact text that I want to be in the message as it appears in the recipient inbox in MIME format")
' same MIME content as code example above
call docMemo.Converttomime(2) ' 2 = CONVERT_RT_TO_HTML_
Call docMemo.Send(False)
I think I must be misunderstanding something fundamental about what the mail router expects and what translations it does.
Another approach is to create a shared calendar link accessible by Outlook as described in this Office support document Create an Add to calendar link in an email message. Sadly this cannot be used as it requires a shared location to store the ics file attachment, which is not suitable in this situation.
I'm pretty much stuck and not sure what to try next.