sending mail when Otlook in 'always prompt for user name and passw

C

Chris Miller

I use the CDO objects to perform outlook integration from an external
application, with Redemption to perform safe mail sending. This works fine
for most modes, however:

If an exchange mail account (and I persume any POP or IMAP accounts are the
same) has the "Always prompt for user name and password" option in its
security settings enabled, I can access the inbox, but not send mail. The
mail I send goes into the Drafts folder and stays there.

Usually, when manually using Outlook, a send and recieve will prompt for the
username and password, however under automation, that prompt seems to be
supressed.

When I issue the Logon command to the namespace, no paramters seem available
to offer authentication for the automation session.

Is there any workaround for this?

I can use RDO objects from redemption if neccissary, or use CDO objects

Many Thanks
 
K

Ken Slovak - [MVP - Outlook]

Sending using code is a 2 step process. First you send the item, then you
start the email transport.

Since Outlook 2002 the old CDO.DeliverNow() method no longer works (nor does
Redemption.MAPIUtils.DeliverNow()) because there is no MAPI spooler. Usually
what people do is to use the Outlook SyncObjects collection, getting
SyncObjects[1] and calling Start() on it. That's the equivalent of manually
using Send/Receive on the default send/receive group.

Even with RDO you still need to engage the transport that way. There's code
showing this on the Redemption Web site, in the FAQ section.
 
C

Chris Miller

Thanks Ken,

That does work as I need it, thanks very much!



Ken Slovak - said:
Sending using code is a 2 step process. First you send the item, then you
start the email transport.

Since Outlook 2002 the old CDO.DeliverNow() method no longer works (nor does
Redemption.MAPIUtils.DeliverNow()) because there is no MAPI spooler. Usually
what people do is to use the Outlook SyncObjects collection, getting
SyncObjects[1] and calling Start() on it. That's the equivalent of manually
using Send/Receive on the default send/receive group.

Even with RDO you still need to engage the transport that way. There's code
showing this on the Redemption Web site, in the FAQ section.




Chris Miller said:
I use the CDO objects to perform outlook integration from an external
application, with Redemption to perform safe mail sending. This works fine
for most modes, however:

If an exchange mail account (and I persume any POP or IMAP accounts are
the
same) has the "Always prompt for user name and password" option in its
security settings enabled, I can access the inbox, but not send mail. The
mail I send goes into the Drafts folder and stays there.

Usually, when manually using Outlook, a send and recieve will prompt for
the
username and password, however under automation, that prompt seems to be
supressed.

When I issue the Logon command to the namespace, no paramters seem
available
to offer authentication for the automation session.

Is there any workaround for this?

I can use RDO objects from redemption if neccissary, or use CDO objects

Many Thanks
 
C

Chris Miller

Further to this fix, I have noticed in outlook 2003 that I get a top most,
blocking authentication window, but in 2007 The window is created but not
pushed to the front, and it does not block.

Does anybody know a way to make the SyncObjects.Start() method block on
outlook 2007. (perhaps I can hand the application a windows handle or
something?)

Any further help is greatly appreciated!

Many thanks



Chris Miller said:
Thanks Ken,

That does work as I need it, thanks very much!



Ken Slovak - said:
Sending using code is a 2 step process. First you send the item, then you
start the email transport.

Since Outlook 2002 the old CDO.DeliverNow() method no longer works (nor does
Redemption.MAPIUtils.DeliverNow()) because there is no MAPI spooler. Usually
what people do is to use the Outlook SyncObjects collection, getting
SyncObjects[1] and calling Start() on it. That's the equivalent of manually
using Send/Receive on the default send/receive group.

Even with RDO you still need to engage the transport that way. There's code
showing this on the Redemption Web site, in the FAQ section.




Chris Miller said:
I use the CDO objects to perform outlook integration from an external
application, with Redemption to perform safe mail sending. This works fine
for most modes, however:

If an exchange mail account (and I persume any POP or IMAP accounts are
the
same) has the "Always prompt for user name and password" option in its
security settings enabled, I can access the inbox, but not send mail. The
mail I send goes into the Drafts folder and stays there.

Usually, when manually using Outlook, a send and recieve will prompt for
the
username and password, however under automation, that prompt seems to be
supressed.

When I issue the Logon command to the namespace, no paramters seem
available
to offer authentication for the automation session.

Is there any workaround for this?

I can use RDO objects from redemption if neccissary, or use CDO objects

Many Thanks
 
K

Ken Slovak - [MVP - Outlook]

SyncObject.Start() starts an asynchronous process, so there's no real
blocking method. You can however subscribe to the SyncObject.SyncEnd() and
SyncObject.OnError() events to let you know when the process stops or fires
an exception.

So what you can do is to loop and check a global Boolean flag that's cleared
when you start the synch and is set (or vice versa) when the SyncEnd() event
fires. I'd also use some sort of fail safe like a check of the system time
in the loop with a maximum allowed loop interval so you avoid the
possibility of an endless loop for whatever reason.

However, since the synch can take varying amounts of time depending on
number and size of messages sent and received, bandwidth to the mail server,
etc. there may be a long blocking period when the synch is started before it
completes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top