Code to auto send message

I’ve set up a button in notes that generates an email and adds a calendar entry using the code below. What it does not do is “auto send” the message. After the window pops up confirming that the entry was added to a calendar, the unsent email is still open. Users have to manually click Send. Is there a way to have the message automatically send?

Thank you for your help!!!

Sub Click(Source As Button)

  'Please specify the name to send this message to:

Const SendToName$="Grace Parks/ESS/EYLLP/US,"

Const CarbonCopy$=""

Const SubjectName$="The whole shabang!"

Const BodyText$="Did it work?"



 '---------------------------------------------------------------------------------

Dim workspace As New NotesUIworkspace

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim db As NotesDatabase

Dim templateName As String



Set uidoc = workspace.ComposeDocument( "", "", "Memo" )    

Set uidoc = workspace.currentdocument

Set doc=uidoc.Document

Set db=doc.ParentDatabase

templateName$=db.DesignTemplateName

If templateName$="EYStdR45Mail" Then

	Call uidoc.fieldsettext("sendto", SendToName)

	Call uidoc.fieldsettext("copyto", CarbonCopy)

Else

	Call uidoc.fieldsettext("Entersendto", SendToName)

	Call uidoc.fieldsettext("EnterCopyTo", CarbonCopy)

	

End If

Call uidoc.fieldsettext("subject", SubjectName)

Call uidoc.fieldsettext("body",BodyText)



Dim ws As New NotesUIWorkspace

Dim session As New notessession

Dim mailfile As String, mailserver As String

Set db = session.CurrentDatabase



Set uidoc = ws.ComposeDocument(db.server, db.filepath, "Appointment")

uidoc.Document.AppointmentType = "0"	

Call uidoc.FieldSetText("AppointmentType","0")

Call uidoc.FieldSetText("Subject", "Lotus Notes Training")

Call uidoc.FieldSetText("Location", "Training Room")

Call uidoc.FieldSetText("StartDate", "11/10/2007")

Call uidoc.FieldSetText("EndDate", "11/10/2007")	

Call uidoc.FieldSetText("StartTime", "09:00 AM CST")

Call uidoc.FieldSetText("EndTime", "11:00 AM CST")

Call uidoc.Save

Call uidoc.Close



Messagebox "The event has been added to your calendar."

End Sub

Subject: Code to auto send message

Add uidoc.Send before the Save and Close

Subject: RE: Code to auto send message

So very simple! Thank you so much. Can’t believe I overlooked that.

Subject: Code to auto send message

when are you actually sending the message?

maildoc.sendto=who to get email?