>>* SendMail Routine >> >>WAIT WINDOW NOWAIT NOCLEAR "Please Wait... Sending Electronic Change Order Files" >> >>* Send mail using MSMAPI >>* Add instances of the MSMAPI.MAPISession and MSMAPI.MAPIMessages OLE controls to this form. >>ThisForm.NewObject("Session1","MAPISess","MAPIClas.vcx") >>ThisForm.NewObject("Message1","MAPIMsgs","MAPIClas.vcx") >> >>* Call the signon method of the MAPISession control. If the user is not >>* logged on to mail, this will prompt the user to logon. This also sets >>* the SessionID property for the MAPIsession control. >>ThisForm.Session1.SignOn >> >>* Set the SessionID of the MAPIMessage control >>* to the SessionID of the MAPISession control, which was just obtained. >>ThisForm.Message1.SessionID = ThisForm.Session1.SessionID >> >>* Start an e-mail message >>ThisForm.Message1.Compose >> >>* Set the Subject line and Message text >>ThisForm.Message1.MsgSubject = "Change Order " + Ord_Ma(2) >>ThisForm.Message1.MsgNoteText = "Electronic Change Order Text file for Order Number: " + Ord_Ma(2) >> >>* Increment the Recipient index >>ThisForm.Message1.RecipIndex = 0 >> >>* Keep track of how many times you loop thru. >>* Should loop thru 1 time for mWhoGets = "P" and >>* should loop thru an additional time for mWhoGets = "C" "E" or "W" >>STORE 0 TO mSendCounter >> >> SET FILTER TO Members.Flag = mWhoGets >> SCAN >> * Attach the proper .txt file >> IF mWhoGets = "P" >> ThisForm.Message1.AttachmentPathname = "ChOPrice.txt" >> ELSE >> ThisForm.Message1.AttachmentPathname = "ChgOrder.txt" >> ENDIF >> * Get figures for Calculating AttachmentPosition >> mMsgNoteTextLength = "Electronic Change Order Text file for Order Number: " + Ord_Ma(2) >> mMsgNoteTextLength = LEN(mMsgNoteTextLength) >> ThisForm.Message1.AttachmentPosition = (mMsgNoteTextLength - 1) && Count starts from position 0 >> * Set the Recipient Name >> ThisForm.Message1.RecipDisplayName = ALLTRIM(Name) >> * Resolve the Recipient Name >> ThisForm.Message1.ResolveName >> * Sends the e-mail message. >> ThisForm.Message1.Send >> ENDSCAN >> SET FILTER TO && Reset FILTER TO filter nothing. >> >>* Remove instances of the MSMAPI.MAPISession and MSMAPI.MAPIMessages OLE controls from this form. >>ThisForm.RemoveObject("Session1","MAPISess","MAPI.vcx") >>ThisForm.RemoveObject("Message1","MAPIMsgs","MAPI.vcx") >> >>* END of SendMail routine. >>