#DEFINE TRUE .T. #DEFINE FALSE .F. #DEFINE NOTES_PWD "optional_your_notes_password_here" *!* If you leave the password blank, the user is prompted for their own. *!* Or get the password from a VFP form textbox. lcAttachment=GETFILE() IF EMPTY(lcAttachment) OR NOT FILE(lcAttachment) RETURN ENDIF DIMENSION laSendTo[1] laSendTo[1] = "youremailaddress@my_isp.com" oNotesSession = CREATEOBJECT("Lotus.NotesSession") TRY oNotesSession.Initialize(NOTES_PWD) && Will give an OLE Exception Error if an error occurs CATCH TO loException WHEN loException.ErrorNo = 1429 AERROR(laCOMException) DO CASE CASE laCOMException[7,1] = 4000 MESSAGEBOX("Notes error: Wrong Password.", 48, "Error!") lblnError = TRUE CASE laCOMException[7,1] = 4492 OTHERWISE && Do primary error handler ENDCASE CATCH TO loException *!* need to modify next line for your own form THISFORM.MOUSEPOINTER = MOUSE_DEFAULT && Do Primary error handler ENDTRY lsMailServer = oNotesSession.GetEnvironmentString("MailServer", TRUE) lsMailDB = oNotesSession.GetEnvironmentString("MailFile", TRUE) loDB = oNotesSession.GetDatabase(lsMailServer, lsMailDB) loDoc = loDB.CreateDocument() loDoc.ReplaceItemValue("Subject", "Subject Text Here") loDoc.ReplaceItemValue("SendTo", @laSendTo) loRTF = loDoc.CreateRichTextItem("Body") WITH loRTF .AppendText("Here is line 1") .AddNewLine(1, TRUE) .AppendText("Here is line 2") .AddNewLine(1, TRUE) && This line adds an attachment there are other types this one is TEXT .EmbedObject(1454, "", lcAttachment) .AddNewLine(2, TRUE) .AppendText("***THIS IS AN AUTOMATED E-MAIL***") .AddNewLine(1,TRUE) .AppendText("You can reply to this message, if necessary.") ENDWITH &&loRTF loDoc.SaveMessageOnSend = TRUE && Saves a copy to sent folder loDoc.SEND(FALSE) && Sends the message RETURN