We help IT Professionals succeed at work.

Help => Array in Function MAPISendMail

jannea
jannea asked
on
485 Views
Last Modified: 2012-05-05
Hello !!

It works fine with just one message attatched or RecipCount <=1 but...
If .FileCount > 1 or .RecipCount > 1 in the Array MAPI generate an error (Nr 2) MAPI_E_FAILURE
Parts of my code:
    'More code before this....
    For X = 0 To Y
    'Other code......
ReDim Preserve MAPIMottagare(X)
    MapiRecip(X).Name = sMottagare$
    MapiRecip(X).Address = s
    MapiRecip(X).Reserved = 0
    MapiRecip(X).RecipClass = 1
    MapiRecip(X).EIDSize = 1000
    MapiRecip(X).EntryID = "" 
    DoEvents
    Next
    'Send mail w/o dialog
    MAPIMeddelande.RecipCount = Y + 1
    lReturn = MAPISendMail(lSession, hwnd, MAPIMsg, MapiRecip(0), MAPIFiles(0), lDialog, 0)
    'lReturn returns 2 instead of 0 here.
    'More code after this....

/Janne
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Hello and thanks !

Sorry I havent respond but I have been bussy.

In the function
lResult = MAPISendMail(lhSession, Form1.hWnd, MyMessage, mr(), MF(), 0&, 0&)
you send mr() instead of mr(0) as I have hear thats the way to do it, I mean sending the first in the array even you got more than one recips or one attatced message. So i did hope that was my problem, but when iI do like this i get the error (ByRef argument type missmatch) so how come it works for you ?

PLS Give me your e-mailadress so I can mail you my function if you can see whats wrong, it still dont works.

/Janne

Commented:
My e-mail is Lasse.Rantanen@sci.fi

Author

Commented:
Thanks Lasse

/Janne, Sweden
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.