I’m trying to edit the standard “Forward MIME to RFC-822” code (button found in INBOX). Basically, the existing code takes the msg you have highlighted and attaches it in a new memo as an .eml attachment and leaves the form up in Edit mode so the user can add a TO:, SUBJECT: and then send it.
But I want to automatically send that data somewhere when someone runs the code. How do I add a TO:, SUBJECT: & have it automatically press the SEND button for me? Can you PLEASE help?
Thank you.
-Scott
Here’s the existing code that I found in our mail template (under the OpenNTFLibraryUI / exportRFC section in Script Libraries):
Sub exportRFC
Dim ws As New NotesUiWorkspace
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim memo As notesdocument
Dim mime As NotesMIMEEntity
Dim stream As notesstream
Dim mimeBoundaryEnd As String, mimeBoundarystart As String, exportFileName As String, directory As String, macro As String
Dim mimeType As String, pathName As String
Dim tmp As Variant
Dim fileNum As Integer, records As Integer
Dim rtItem As notesrichtextitem
'=> init
Set db = sess.CurrentDatabase
sess.ConvertMIME = False ' Do not convert MIME to rich text
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
directory$ = sess.GetEnvironmentstring("Directory",True)
fileNum% = Freefile()
records% = 0
'=> create the forwarding memo
Set memo = db.CreateDocument
memo.form = "Memo"
Set rtItem = New notesRichTextItem(memo,"Body")
While Not(doc Is Nothing)
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
Set stream = sess.Createstream
pathName$ = doc.subject(0)
'macro$ = {@urlencode("Domino";"} + doc.subject(0) + {")}
macro$ = {@Ascii( "} + doc.subject(0) + {" ) }
tmp = Evaluate(macro$)
macro$ = {@replacesubstring("} + tmp(0) + {";":":"?":"!";"")}
tmp = Evaluate(macro$)
' exportFileName$ = directory$ + "\" + tmp(0) + " -- " + doc.NoteID + ".eml"
exportFileName$ = directory$ + "\" + tmp(0) + ".eml"
If Dir$(exportFileName$) <> "" Then
Kill exportFileName$
End If
Call stream.Open(exportFileName$, mime.Charset)
mimeType = mime.ContentType
mimeBoundarystart = mime.Boundarystart
mimeBoundaryEnd = mime.BoundaryEnd
Call mime.GetEntityAsText(stream)
Set mime=mime.GetNextEntity
While Not (mime Is Nothing)
Call stream.WriteText("",3)
'Call stream.WriteText(multiMIME$,3)
Call stream.WriteText(mime.Boundarystart)
Call mime.DecodeContent()
Call mime.EncodeContent( 1727 )
Call mime.GetEntityAsText(stream)
Call stream.Writetext(mime.BoundaryEnd)
Set mime=mime.GetNextEntity
Wend
Call stream.Writetext(mimeBoundaryEnd)
Call stream.Close
'=> attach file
Call rtItem.embedobject(EMBED_ATTACHMENT,"",exportFileName$)
'=> clean up
Kill exportFileName$
Else
Messagebox doc.GetItemValue("subject")(0),,"Memo not in MIME format."
End If
Set doc = dc.GetNextDocument(doc)
Wend
sess.ConvertMIME = True ' Restore conversion
'=> open the forwarding memo
Call memo.ComputeWithForm(True,False)
Call ws.EditDocument(True,memo)
End Sub