Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSMAPI only works with one recipient
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00768102
Message ID:
00768646
Vues:
17
Can this help?
* 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
>
>
>That works great. The code to add the second recipient is:
>
>
>if not empty(this.cCC) or not empty(.cCCDisplayName)
>   .RecipIndex       = 1
>   .RecipAddress     = alltrim(this.cCC)
>   .RecipType        = 2
>endif
>
>
>I also have some code to add attachments, but the main thing here is that everything works fine with one recipient and zero, one, or more attachments. When I let the code to add the second recipient execute, I get the "unspecified error".
>
>Anybody see any problems with this code or have any suggestions/fixes?
>
>Thanks,
>
>Russell Campbell
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform