MAPI Question 
Author Message
 MAPI Question

I've got a control that sends e-mail for me using the MAPIMessages and
MAPISession objects.  It has to work with addresses that are not necessarily
in the address book of the sender.  If the recipient's address is not in the
sender's address book, the user gets an "Unknown Recipient".  The user can
click Ok and the e-mail message will come up, but when it is actually sent,
it fails with a "Your message did not reach some of the intended recipients"
message.  Please note that this is not a bounce back.  Outlook must be
trying again to resolve the name against the address book and when it can't,
it just won't send it.  So I located some documentation on how to build an
e-mail address that would pass muster without being in the address book.

Basically the address had to have a format like this:

<Name>[SMTP:<e-mail address>]


(without the quotes, of course).

Unfortunately, this is not working and now I can't find the document that
showed me how to format an address that will pass muster and be sent even if
it does not resolve to an entry in the address book.  There must be a way to
do this, since it would be asinine to expect every address that e-mail might
be sent to to also be in the address book.  I'm sure it's just a minor thing
to get it working, but I've tried little changes here and there and haven't
hit upon the right format.  Does anyone know how to make this work?

Thanks,

Russell Campbell



Mon, 29 Aug 2005 00:18:36 GMT  
 MAPI Question
Russell,


directly ?

Prior to sending the message you can use oleMessage.ResolveName() witch will

exists in the senders addressbook.  If there's no such entry it wil leave

Gregory
___________


Quote:
> I've got a control that sends e-mail for me using the MAPIMessages and
> MAPISession objects.  It has to work with addresses that are not
necessarily
> in the address book of the sender.  If the recipient's address is not in
the
> sender's address book, the user gets an "Unknown Recipient".  The user can
> click Ok and the e-mail message will come up, but when it is actually
sent,
> it fails with a "Your message did not reach some of the intended
recipients"
> message.  Please note that this is not a bounce back.  Outlook must be
> trying again to resolve the name against the address book and when it
can't,
> it just won't send it.  So I located some documentation on how to build an
> e-mail address that would pass muster without being in the address book.

> Basically the address had to have a format like this:

> <Name>[SMTP:<e-mail address>]


> (without the quotes, of course).

> Unfortunately, this is not working and now I can't find the document that
> showed me how to format an address that will pass muster and be sent even
if
> it does not resolve to an entry in the address book.  There must be a way
to
> do this, since it would be asinine to expect every address that e-mail
might
> be sent to to also be in the address book.  I'm sure it's just a minor
thing
> to get it working, but I've tried little changes here and there and
haven't
> hit upon the right format.  Does anyone know how to make this work?

> Thanks,

> Russell Campbell



Mon, 29 Aug 2005 00:48:51 GMT  
 MAPI Question
Well, dumb me.  I didn't try using the actual e-mail address without a
Display Name.  I guess Outlook assumes that if something is in the Display
Name, then it must be in the address book and if it doesn't find the Display
Name it won't send it.  I was just trying to get things looking a little
prettier by using a Display Name with the e-mail address, but obviously
that's not going to be an option.  Thanks.


Quote:
> Russell,


> directly ?

> Prior to sending the message you can use oleMessage.ResolveName() witch
will

> exists in the senders addressbook.  If there's no such entry it wil leave

> Gregory
> ___________



> > I've got a control that sends e-mail for me using the MAPIMessages and
> > MAPISession objects.  It has to work with addresses that are not
> necessarily
> > in the address book of the sender.  If the recipient's address is not in
> the
> > sender's address book, the user gets an "Unknown Recipient".  The user
can
> > click Ok and the e-mail message will come up, but when it is actually
> sent,
> > it fails with a "Your message did not reach some of the intended
> recipients"
> > message.  Please note that this is not a bounce back.  Outlook must be
> > trying again to resolve the name against the address book and when it
> can't,
> > it just won't send it.  So I located some documentation on how to build
an
> > e-mail address that would pass muster without being in the address book.

> > Basically the address had to have a format like this:

> > <Name>[SMTP:<e-mail address>]

> > With an example being "Bob


- Show quoted text -

Quote:
> > (without the quotes, of course).

> > Unfortunately, this is not working and now I can't find the document
that
> > showed me how to format an address that will pass muster and be sent
even
> if
> > it does not resolve to an entry in the address book.  There must be a
way
> to
> > do this, since it would be asinine to expect every address that e-mail
> might
> > be sent to to also be in the address book.  I'm sure it's just a minor
> thing
> > to get it working, but I've tried little changes here and there and
> haven't
> > hit upon the right format.  Does anyone know how to make this work?

> > Thanks,

> > Russell Campbell



Mon, 29 Aug 2005 02:44:37 GMT  
 MAPI Question
Oh, also, the document I found before - that I can't locate now - lead me to
believe that I could use a Display Name with the actual e-mail address and
get Outlook to send it, but maybe that's not the case (or maybe I still have
a problem with the formatting).  Anyway, I can live without the display
name.


Quote:
> Russell,


> directly ?

> Prior to sending the message you can use oleMessage.ResolveName() witch
will

> exists in the senders addressbook.  If there's no such entry it wil leave

> Gregory
> ___________



> > I've got a control that sends e-mail for me using the MAPIMessages and
> > MAPISession objects.  It has to work with addresses that are not
> necessarily
> > in the address book of the sender.  If the recipient's address is not in
> the
> > sender's address book, the user gets an "Unknown Recipient".  The user
can
> > click Ok and the e-mail message will come up, but when it is actually
> sent,
> > it fails with a "Your message did not reach some of the intended
> recipients"
> > message.  Please note that this is not a bounce back.  Outlook must be
> > trying again to resolve the name against the address book and when it
> can't,
> > it just won't send it.  So I located some documentation on how to build
an
> > e-mail address that would pass muster without being in the address book.

> > Basically the address had to have a format like this:

> > <Name>[SMTP:<e-mail address>]

> > With an example being "Bob


- Show quoted text -

Quote:
> > (without the quotes, of course).

> > Unfortunately, this is not working and now I can't find the document
that
> > showed me how to format an address that will pass muster and be sent
even
> if
> > it does not resolve to an entry in the address book.  There must be a
way
> to
> > do this, since it would be asinine to expect every address that e-mail
> might
> > be sent to to also be in the address book.  I'm sure it's just a minor
> thing
> > to get it working, but I've tried little changes here and there and
> haven't
> > hit upon the right format.  Does anyone know how to make this work?

> > Thanks,

> > Russell Campbell



Mon, 29 Aug 2005 02:47:39 GMT  
 MAPI Question
Well, it's always something.  This works fine for the main recipient,
however I was also cc:ing it to someone else.  For some reason it fails with
an OLE error (1429) when I let the CC code run (I had it commented out while
testing).  This is the case regardless of whether I make the second
recipient a To recipient or a CC recipient.


Quote:
> Russell,


> directly ?

> Prior to sending the message you can use oleMessage.ResolveName() witch
will

> exists in the senders addressbook.  If there's no such entry it wil leave

> Gregory
> ___________



> > I've got a control that sends e-mail for me using the MAPIMessages and
> > MAPISession objects.  It has to work with addresses that are not
> necessarily
> > in the address book of the sender.  If the recipient's address is not in
> the
> > sender's address book, the user gets an "Unknown Recipient".  The user
can
> > click Ok and the e-mail message will come up, but when it is actually
> sent,
> > it fails with a "Your message did not reach some of the intended
> recipients"
> > message.  Please note that this is not a bounce back.  Outlook must be
> > trying again to resolve the name against the address book and when it
> can't,
> > it just won't send it.  So I located some documentation on how to build
an
> > e-mail address that would pass muster without being in the address book.

> > Basically the address had to have a format like this:

> > <Name>[SMTP:<e-mail address>]

> > With an example being "Bob


- Show quoted text -

Quote:
> > (without the quotes, of course).

> > Unfortunately, this is not working and now I can't find the document
that
> > showed me how to format an address that will pass muster and be sent
even
> if
> > it does not resolve to an entry in the address book.  There must be a
way
> to
> > do this, since it would be asinine to expect every address that e-mail
> might
> > be sent to to also be in the address book.  I'm sure it's just a minor
> thing
> > to get it working, but I've tried little changes here and there and
> haven't
> > hit upon the right format.  Does anyone know how to make this work?

> > Thanks,

> > Russell Campbell



Mon, 29 Aug 2005 03:48:01 GMT  
 MAPI Question
Russel,

Do not know why (old code I guess), but I trap and ignore  the error on any
ResolveName().  That is why I never see any error whilst proceeding like I
mentioned.

Maybe, it tries to resolve and errors when it cannot.  Since we provide a
valid email address, th error can be ignored.

Success,

Gregory
____________


Quote:
> Well, it's always something.  This works fine for the main recipient,
> however I was also cc:ing it to someone else.  For some reason it fails
with
> an OLE error (1429) when I let the CC code run (I had it commented out
while
> testing).  This is the case regardless of whether I make the second
> recipient a To recipient or a CC recipient.



> > Russell,

> > Do you still have a problem is you use


Quote:
> > directly ?

> > Prior to sending the message you can use oleMessage.ResolveName() witch
> will

entry
> > exists in the senders addressbook.  If there's no such entry it wil
leave

> > Gregory
> > ___________



> > > I've got a control that sends e-mail for me using the MAPIMessages and
> > > MAPISession objects.  It has to work with addresses that are not
> > necessarily
> > > in the address book of the sender.  If the recipient's address is not
in
> > the
> > > sender's address book, the user gets an "Unknown Recipient".  The user
> can
> > > click Ok and the e-mail message will come up, but when it is actually
> > sent,
> > > it fails with a "Your message did not reach some of the intended
> > recipients"
> > > message.  Please note that this is not a bounce back.  Outlook must be
> > > trying again to resolve the name against the address book and when it
> > can't,
> > > it just won't send it.  So I located some documentation on how to
build
> an
> > > e-mail address that would pass muster without being in the address
book.

> > > Basically the address had to have a format like this:

> > > <Name>[SMTP:<e-mail address>]

> > > With an example being "Bob

> > > (without the quotes, of course).

> > > Unfortunately, this is not working and now I can't find the document
> that
> > > showed me how to format an address that will pass muster and be sent
> even
> > if
> > > it does not resolve to an entry in the address book.  There must be a
> way
> > to
> > > do this, since it would be asinine to expect every address that e-mail
> > might
> > > be sent to to also be in the address book.  I'm sure it's just a minor
> > thing
> > > to get it working, but I've tried little changes here and there and
> > haven't
> > > hit upon the right format.  Does anyone know how to make this work?

> > > Thanks,

> > > Russell Campbell



Mon, 29 Aug 2005 06:33:47 GMT  
 MAPI Question
Unfortunately, the error causes the message to not be created.  So what I'm
seeing is different that what you are seeing.  Here's the code:

  if not empty(this.cTo)
   .RecipIndex       = 0
   .RecipDisplayName = alltrim(this.cDisplayName)
   .RecipAddress     = alltrim(this.cTo)
   .RecipType        = 1
  endif

  if not empty(this.cCC)
   .RecipIndex       = 1
   .RecipDisplayName = alltrim(this.cCCDisplayName)
   .RecipAddress     = alltrim(this.cCC)
   .RecipType        = 2
  endif

If I comment out the second block, it works.  If I uncomment the second
block, it fails.  Do you have any other thoughts on this?

Thanks,

Russell Campbell


Quote:
> Russel,

> Do not know why (old code I guess), but I trap and ignore  the error on
any
> ResolveName().  That is why I never see any error whilst proceeding like I
> mentioned.

> Maybe, it tries to resolve and errors when it cannot.  Since we provide a
> valid email address, th error can be ignored.

> Success,

> Gregory
> ____________



> > Well, it's always something.  This works fine for the main recipient,
> > however I was also cc:ing it to someone else.  For some reason it fails
> with
> > an OLE error (1429) when I let the CC code run (I had it commented out
> while
> > testing).  This is the case regardless of whether I make the second
> > recipient a To recipient or a CC recipient.


message

> > > Russell,

> > > Do you still have a problem is you use

> > > directly ?

> > > Prior to sending the message you can use oleMessage.ResolveName()
witch
> > will

> entry
> > > exists in the senders addressbook.  If there's no such entry it wil
> leave

> > > Gregory
> > > ___________



> > > > I've got a control that sends e-mail for me using the MAPIMessages
and
> > > > MAPISession objects.  It has to work with addresses that are not
> > > necessarily
> > > > in the address book of the sender.  If the recipient's address is
not
> in
> > > the
> > > > sender's address book, the user gets an "Unknown Recipient".  The
user
> > can
> > > > click Ok and the e-mail message will come up, but when it is
actually
> > > sent,
> > > > it fails with a "Your message did not reach some of the intended
> > > recipients"
> > > > message.  Please note that this is not a bounce back.  Outlook must
be
> > > > trying again to resolve the name against the address book and when
it
> > > can't,
> > > > it just won't send it.  So I located some documentation on how to
> build
> > an
> > > > e-mail address that would pass muster without being in the address
> book.

> > > > Basically the address had to have a format like this:

> > > > <Name>[SMTP:<e-mail address>]

> > > > With an example being "Bob

> > > > (without the quotes, of course).

> > > > Unfortunately, this is not working and now I can't find the document
> > that
> > > > showed me how to format an address that will pass muster and be sent
> > even
> > > if
> > > > it does not resolve to an entry in the address book.  There must be
a
> > way
> > > to
> > > > do this, since it would be asinine to expect every address that
e-mail
> > > might
> > > > be sent to to also be in the address book.  I'm sure it's just a
minor
> > > thing
> > > > to get it working, but I've tried little changes here and there and
> > > haven't
> > > > hit upon the right format.  Does anyone know how to make this work?

> > > > Thanks,

> > > > Russell Campbell



Mon, 29 Aug 2005 23:02:13 GMT  
 MAPI Question
Russell,

Maybe this.cTo is empty.  You cannot set the RecipIndex to any other value
than RecipCount.

Another difference I see is that I set the address directly in
RecipDisplayName without using the RecipAddress.

The code below works for me.  I do not remember why I set the RecipType once
before the ResolveName and once after the ResolveName

Try this.  If it works, change it a bit so you can pass it a string of cTo,
cCc and cBcc separated with commas and work with a for/next loop

.RecipIndex              =  .RecipCount

.RecipType                = 1 && The recipient is a primary recipient
.ResolveName  && resolve the name
.RecipType                = 1 && The recipient is a primary recipient

.RecipIndex                =  .RecipCount

.RecipType               = 2 && The recipient is a copy recipient
.ResolveName  && resolve the name
.RecipType               = 2 && The recipient is a copy recipient

.RecipIndex                =  .RecipCount

.RecipType                 = 3 &&  The recipient is a blind copy recipient
.ResolveName  && resolve the name
.RecipType                 = 3 &&  The recipient is a blind copy recipient

Success,

Gregory
________________________

Quote:
> Unfortunately, the error causes the message to not be created.  So what
I'm
> seeing is different that what you are seeing.  Here's the code:

>   if not empty(this.cTo)
>    .RecipIndex       = 0
>    .RecipDisplayName = alltrim(this.cDisplayName)
>    .RecipAddress     = alltrim(this.cTo)
>    .RecipType        = 1
>   endif

>   if not empty(this.cCC)
>    .RecipIndex       = 1
>    .RecipDisplayName = alltrim(this.cCCDisplayName)
>    .RecipAddress     = alltrim(this.cCC)
>    .RecipType        = 2
>   endif

> If I comment out the second block, it works.  If I uncomment the second
> block, it fails.  Do you have any other thoughts on this?

> Thanks,

> Russell Campbell



> > Russel,

> > Do not know why (old code I guess), but I trap and ignore  the error on
> any
> > ResolveName().  That is why I never see any error whilst proceeding like
I
> > mentioned.

> > Maybe, it tries to resolve and errors when it cannot.  Since we provide
a
> > valid email address, th error can be ignored.

> > Success,

> > Gregory
> > ____________



> > > Well, it's always something.  This works fine for the main recipient,
> > > however I was also cc:ing it to someone else.  For some reason it
fails
> > with
> > > an OLE error (1429) when I let the CC code run (I had it commented out
> > while
> > > testing).  This is the case regardless of whether I make the second
> > > recipient a To recipient or a CC recipient.


> message

> > > > Russell,

> > > > Do you still have a problem is you use

> > > > directly ?

> > > > Prior to sending the message you can use oleMessage.ResolveName()
> witch
> > > will

> > entry
> > > > exists in the senders addressbook.  If there's no such entry it wil
> > leave

> > > > Gregory
> > > > ___________



> > > > > I've got a control that sends e-mail for me using the MAPIMessages
> and
> > > > > MAPISession objects.  It has to work with addresses that are not
> > > > necessarily
> > > > > in the address book of the sender.  If the recipient's address is
> not
> > in
> > > > the
> > > > > sender's address book, the user gets an "Unknown Recipient".  The
> user
> > > can
> > > > > click Ok and the e-mail message will come up, but when it is
> actually
> > > > sent,
> > > > > it fails with a "Your message did not reach some of the intended
> > > > recipients"
> > > > > message.  Please note that this is not a bounce back.  Outlook
must
> be
> > > > > trying again to resolve the name against the address book and when
> it
> > > > can't,
> > > > > it just won't send it.  So I located some documentation on how to
> > build
> > > an
> > > > > e-mail address that would pass muster without being in the address
> > book.

> > > > > Basically the address had to have a format like this:

> > > > > <Name>[SMTP:<e-mail address>]

> > > > > With an example being "Bob

> > > > > (without the quotes, of course).

> > > > > Unfortunately, this is not working and now I can't find the
document
> > > that
> > > > > showed me how to format an address that will pass muster and be
sent
> > > even
> > > > if
> > > > > it does not resolve to an entry in the address book.  There must
be
> a
> > > way
> > > > to
> > > > > do this, since it would be asinine to expect every address that
> e-mail
> > > > might
> > > > > be sent to to also be in the address book.  I'm sure it's just a
> minor
> > > > thing
> > > > > to get it working, but I've tried little changes here and there
and
> > > > haven't
> > > > > hit upon the right format.  Does anyone know how to make this
work?

> > > > > Thanks,

> > > > > Russell Campbell



Tue, 30 Aug 2005 00:04:43 GMT  
 MAPI Question
Setting RecipIndex auto-increments RecipCount.  RecipIndex is zero-based so
the first recipient is recipient zero and the second recipient is recipient
one.  At the outset of your code RecipCount should be zero, so you are
assigning the first recipient and RecipCount should change to 1.  Then the
next time you are setting RecipIndex to 1 (current value of RecipCount) and
this assigns the second recipient and RecipCount goes to 2.  The third time,
you are setting RecipIndex to 2 (current value of RecipCount) and this
assigns the third recipient and RecipCount goes to 3.  So it works, but it
should be no different than simply assigning RecipIndex a value of 0 and
then a value of 1 directly.  I will try using the display name as you
suggest (I've already verified that THIS.CTO is not empty).

Thanks for your perseverance on this.


Quote:
> Russell,

> Maybe this.cTo is empty.  You cannot set the RecipIndex to any other value
> than RecipCount.

> Another difference I see is that I set the address directly in
> RecipDisplayName without using the RecipAddress.

> The code below works for me.  I do not remember why I set the RecipType
once
> before the ResolveName and once after the ResolveName

> Try this.  If it works, change it a bit so you can pass it a string of
cTo,
> cCc and cBcc separated with commas and work with a for/next loop

> .RecipIndex              =  .RecipCount

> .RecipType                = 1 && The recipient is a primary recipient
> .ResolveName  && resolve the name
> .RecipType                = 1 && The recipient is a primary recipient

> .RecipIndex                =  .RecipCount

> .RecipType               = 2 && The recipient is a copy recipient
> .ResolveName  && resolve the name
> .RecipType               = 2 && The recipient is a copy recipient

> .RecipIndex                =  .RecipCount

> .RecipType                 = 3 &&  The recipient is a blind copy recipient
> .ResolveName  && resolve the name
> .RecipType                 = 3 &&  The recipient is a blind copy recipient

> Success,

> Gregory
> ________________________


> > Unfortunately, the error causes the message to not be created.  So what
> I'm
> > seeing is different that what you are seeing.  Here's the code:

> >   if not empty(this.cTo)
> >    .RecipIndex       = 0
> >    .RecipDisplayName = alltrim(this.cDisplayName)
> >    .RecipAddress     = alltrim(this.cTo)
> >    .RecipType        = 1
> >   endif

> >   if not empty(this.cCC)
> >    .RecipIndex       = 1
> >    .RecipDisplayName = alltrim(this.cCCDisplayName)
> >    .RecipAddress     = alltrim(this.cCC)
> >    .RecipType        = 2
> >   endif

> > If I comment out the second block, it works.  If I uncomment the second
> > block, it fails.  Do you have any other thoughts on this?

> > Thanks,

> > Russell Campbell


message

> > > Russel,

> > > Do not know why (old code I guess), but I trap and ignore  the error
on
> > any
> > > ResolveName().  That is why I never see any error whilst proceeding
like
> I
> > > mentioned.

> > > Maybe, it tries to resolve and errors when it cannot.  Since we
provide
> a
> > > valid email address, th error can be ignored.

> > > Success,

> > > Gregory
> > > ____________



> > > > Well, it's always something.  This works fine for the main
recipient,
> > > > however I was also cc:ing it to someone else.  For some reason it
> fails
> > > with
> > > > an OLE error (1429) when I let the CC code run (I had it commented
out
> > > while
> > > > testing).  This is the case regardless of whether I make the second
> > > > recipient a To recipient or a CC recipient.


> > message

> > > > > Russell,

> > > > > Do you still have a problem is you use

> > > > > directly ?

> > > > > Prior to sending the message you can use oleMessage.ResolveName()
> > witch
> > > > will

an
> > > entry
> > > > > exists in the senders addressbook.  If there's no such entry it
wil
> > > leave

> > > > > Gregory
> > > > > ___________



> > > > > > I've got a control that sends e-mail for me using the
MAPIMessages
> > and
> > > > > > MAPISession objects.  It has to work with addresses that are not
> > > > > necessarily
> > > > > > in the address book of the sender.  If the recipient's address
is
> > not
> > > in
> > > > > the
> > > > > > sender's address book, the user gets an "Unknown Recipient".
The
> > user
> > > > can
> > > > > > click Ok and the e-mail message will come up, but when it is
> > actually
> > > > > sent,
> > > > > > it fails with a "Your message did not reach some of the intended
> > > > > recipients"
> > > > > > message.  Please note that this is not a bounce back.  Outlook
> must
> > be
> > > > > > trying again to resolve the name against the address book and
when
> > it
> > > > > can't,
> > > > > > it just won't send it.  So I located some documentation on how
to
> > > build
> > > > an
> > > > > > e-mail address that would pass muster without being in the
address
> > > book.

> > > > > > Basically the address had to have a format like this:

> > > > > > <Name>[SMTP:<e-mail address>]

> > > > > > With an example being "Bob

> > > > > > (without the quotes, of course).

> > > > > > Unfortunately, this is not working and now I can't find the
> document
> > > > that
> > > > > > showed me how to format an address that will pass muster and be
> sent
> > > > even
> > > > > if
> > > > > > it does not resolve to an entry in the address book.  There must
> be
> > a
> > > > way
> > > > > to
> > > > > > do this, since it would be asinine to expect every address that
> > e-mail
> > > > > might
> > > > > > be sent to to also be in the address book.  I'm sure it's just a
> > minor
> > > > > thing
> > > > > > to get it working, but I've tried little changes here and there
> and
> > > > > haven't
> > > > > > hit upon the right format.  Does anyone know how to make this
> work?

> > > > > > Thanks,

> > > > > > Russell Campbell



Tue, 30 Aug 2005 09:42:43 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. FoxPro / MAPI question

2. Mapi Question

3. MAPI question

4. MAPI control question

5. MAPI Messages Control (Add Recipient)

6. MAPI happy

7. Mapi Login has failed

8. MAPI mail problem

9. MAPI/Attachment

10. MAPI and HTML

11. Mapi Problem

12. Mapi problems

 

 
Powered by phpBB® Forum Software