I can create the memo, just can't send it. How?

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

Subject: I can create the memo, just can’t send it. How?

In the designer help search for mail fields, and add those fields to yr code.

Subject: RE: I can create the memo, just can’t send it. How?

Thanks - mostly, these are formula based and all the rest of my code is LotuScript. Its got to be just about as simple as your pointing out… I just don’t know much about LotuScript. Thanks though!

Subject: RE: I can create the memo, just can’t send it. How?

U just need to use the same fieldnames if using formula u use

Field SendTo := …

in script you would use

doc.SendTo = …

Just make sure the fieldnames are spelled correctly CAse is not important

Subject: RE: I can create the memo, just can’t send it. How?

In addition to what Yazdi says about setting the SendTo field, if you just want to sent the message and not display it in edit mode then replace the line:

Call ws.EditDocument(True,memo)

with

Call memo.Send( false, Recipients)

Recipients is optional if you set the SendTo field on memo.

Subject: RE: I can create the memo, just can’t send it. How?

That was the missing piece that I was unfamiliar with. Changing those two lines did exactly what I was looking for! Thanks so much guys.