How to create an email in a client's default mail client

S

Sue L.

Hi I need to create and send an email using MAPI that works when the client
is using outlook express, or a variety of versions of outlook.

I think this code will work with a variety of outlook versions, but it
doesn't work with outlook express

What do I need to do differently to work with Outlook Express and Outlook?

-------------- Code Snippet
Set oApp = CreateObject("Outlook.Application")
Set oOutbox = oApp.GetNamespace("MAPI").GetDefaultFolder(4) '4 =
olFolderOutbox enum value
Set oEmail = oApp.CreateItem(0) '0 - olMailItem enum value
http://msdn.microsoft.com/en-us/library/bb277434(v=office.12).aspx
With oEmail
.To = SendTo
.Subject = Subject
.Body = Body
.Recipients.ResolveAll
.Save
.send

End With
Set oEmail = Nothing
Set oOutbox = Nothing

Set oApp = Nothing
 
D

Daniel Pineault

Outlook and Outlook Express do not code at all the same way.

If you wish to use vba coding for OE then take a look at
http://bytes.com/topic/access/answers/190253-repost-attachments-outlook-express-possible

Take a look at the post by Lyle Fairfield in which he give a complete
class-code specific for OE.

Depending on your needs, why not simply use the SendObject Method, or CDO?
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
S

Sue L.

Ahhh, Sendobject --- That seems to work great. Easy Solution. Will that
really work on all types of email clients???
---- DoCmd.SendObject , , , SendTo, , , Subject, Body, False

I tried CDO too with:

----
set oEmail = CreateObject("Cdo.message")
With oEmail
.To = SendTo
.From = From
.Subject = Subject
.textBody = Body
.send

End With

--------------
I got an error message: that my sendusing configuration is invalid. How do
I use CDO to send through MAPI? I don't want to directly send through SMTP
(client restrictions)

Well, if SendObject works for everything, then the CDO doesn't matter.

Thanks

Sue

:
 
M

Mark Andrews

You could use a smtp component then you just need the smtp server and login
info.
Gets you away from relying on what's installed on the users' computer a bit.
Most SMTP components are one dll file.

Just another option,
 

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