MSMAPI won't work with more than one recipient 
Author Message
 MSMAPI won't work with more than one recipient

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
endifThat 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
endifI 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



Tue, 06 Sep 2005 00:00:23 GMT  
 MSMAPI won't work with more than one recipient
Russell,
Did you create your own class or did you use the one that came with VFP?

-Bruce Duncan


Quote:
> 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
> endifThat 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
> endifI 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



Tue, 06 Sep 2005 00:48:10 GMT  
 MSMAPI won't work with more than one recipient
Russell,

this works for me

with oleMAPIMessages
   .Compose()

* Set the Recipient name and resolve

   .RecipType = 1
   .ResolveName()

   .RecipIndex = 1

   .RecipType = 2
   .ResolveName()

   .MsgSubject = "This is the Subject"
   .MsgNoteText = "This is the email text"

   .Send( .f. )
endwith

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro


Quote:
> 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
> endifThat 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
> endifI 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



Tue, 06 Sep 2005 10:31:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. What's wrong with me - easy filter in 2.5 won't work

2. Won't run on only one computer

3. One to many grid won't REFRESH()

4. One APPE FROM statement suddenly doesn't work right

5. Why won't SQLExec work?

6. My Foxpro program won't work in Windows NT 4.0 __Help__

7. VFP SetFocus Method Won't Work!

8. Why this won't work?

9. Why won't my breakpoints work!

10. Y2K work prepares one for Y25 work

11. DOS Version work but WINDOWS doesn't work

12. VFP6 won't work on one workstation. Why?

 

 
Powered by phpBB® Forum Software