* To make this one work in distributed EXE you have to merge this into registry: *!* REGEDIT4 *!* [HKEY_CLASSES_ROOT\Licenses] *!* [HKEY_CLASSES_ROOT\Licenses\899B3E80-6AC6-11cf-8ADB-00AA00C00905] *!* @="wjsjjjlqmjpjrjjjvpqqkqmqukypoqjquoun" LPARAMETERS sSubject, sMessage, sRecipients, sAttachments LOCAL oMapiSession, oMessage, iRecipients, aRecipients, iRecipient ; , iAttachment, iAttachments, aAttachments DIMENSION aRecipients[1], aAttachments[1] oMapiSession = CreateObject("MSMAPI.MAPISession.1") oMapiSession.DownLoadMail = .f. oMapiSession.SignOn oMessage = CreateObject("MSMAPI.MAPIMessages.1") oMessage.SessionID = oMapiSession.SessionID oMessage.Compose oMessage.MsgIndex = -1 oMessage.MsgNoteText = sMessage ; + Chr(10) + Chr(13) + Chr(10) + Chr(13) ; + "Additional information:" ; + Chr(10) + Chr(13) + Chr(10) + Chr(13) oMessage.MsgSubject = sSubject oMessage.MsgReceiptRequested = .t. oMessage.AddressEditFieldCount = 4 IF !EMPTY(sRecipients) iRecipients = ALINES(aRecipients, sRecipients, .t., ";") FOR iRecipient = 1 TO iRecipients oMessage.RecipIndex = oMessage.RecipCount oMessage.RecipDisplayName = aRecipients[iRecipient] ENDFOR ENDIF IF !EMPTY(sAttachments) iAttachments = ALINES(aAttachments, sAttachments, .t., ";") FOR iAttachment = 1 TO iAttachments oMessage.AttachmentPosition = iAttachment oMessage.AttachmentPathName = aAttachments[iAttachment] ENDFOR ENDIF oMessage.SEND(.t.) oMapiSession.SignOff RETURN>I have a class to send e-mail using MSMAPI. It works fine. Until I add a second TO or CC recipient. I get an "unspecified error" message. The code to add the first recipient is:
>if not empty(this.cTo) or not empty(.cDisplayName) > .RecipIndex = 0 > .RecipAddress = alltrim(this.cTo) > .RecipType = 1 >endif >>
>if not empty(this.cCC) or not empty(.cCCDisplayName) > .RecipIndex = 1 > .RecipAddress = alltrim(this.cCC) > .RecipType = 2 >endif >>