Mapi/CDO Outlook emailing

J

Jon Lewis

I'm using a mapi/cdo routine (based on code from Sue Mosher) to generate a
mass email from a CRM Access application.

I'm looping through a recordset adding email body/attachments etc and then

objOutlookMsg.Close (olSave)
objOutlookMsg.Move objOutlookDestFolder

for each message saves the email to the Outlook Outbox and only one security
warning is thrown for the entire session which is fine.

However, all the messages in the Outbox are non-italicised, i.e. each one
has to be opened up and Send clicked.

If I add objOutlookMsg.Send to the loop, I get a separate security dialog
box for each email

How can I avoid this.

TIA
 
J

Jon Lewis

Hi Sue

I 've already read your object model guard page. I'm using your code from
http://www.outlookcode.com/d/code/htmlimg.htm
to embed an image.

I idealy want Outlook to do the sending and would like the set of messages
to be waiting in the outbox but in the italicised state i.e. when Tools>Send
& Receive is selected they are all sent in one operation. (Auto send would
be turned off)

Sound like it's not possible without individual security prompts if
objOutlookMsg.Send is in the messageset code loop.

Manually selecting all the messages once they're in the Outlook Outbox and
chaging their state to Send would be OK but doesn't appear to be possible
either.

If I'm understanding your image embedding routine correctly, you have to use
Outlook to add the HTML body having created the imageID using CDO.

So after the ' get the Outlook MailItem again
Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntryID)
' add HTML content -- the <IMG> tag
l_Msg.HTMLBody = "<IMG align=baseline border=0 hspace=0 src=cid:myident>"
l_Msg.Close (olSave)

...Routine

Can I then use the not yet de-referenced MAPI.Message object to send the
email with CDO?

Many thanks for your help

Jon


You need to call Send for each item to send it. See
http://www.outlookcode.com/article.aspx?ID=52 for your options with regard
to the "object model guard" security prompts.
 
S

Sue Mosher [MVP-Outlook]

CDO 1.21 is subject to security prompts. I would suggest that you use either Redemption or CDO for Windows, depending on whether you need to maintain a record of the sent messages in the current user's folders.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
J

Jon Lewis

Thanks Sue

What about this though?

http://www.mapilab.com/outlook/security

Sounds like it should work



CDO 1.21 is subject to security prompts. I would suggest that you use either
Redemption or CDO for Windows, depending on whether you need to maintain a
record of the sent messages in the current user's folders.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
J

Jon Lewis

I'm sure you're right Sue but as I understand it CDO for Windows bypasses
Outlook completely and Redemption costs $200 even for small internal
application use.

Thanks for your help

Avoiding the prompts completely by writing code with Redemption or CDO for
Windows is a better solution, IMO.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 

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