PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

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

 
 
Sue L.
Guest
Posts: n/a
 
      1st Apr 2010
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/libr...ice.12%29.aspx
With oEmail
.To = SendTo
.Subject = Subject
.Body = Body
.Recipients.ResolveAll
.Save
.send

End With
Set oEmail = Nothing
Set oOutbox = Nothing

Set oApp = Nothing

-------------

Thanks,
 
Reply With Quote
 
 
 
 
Daniel Pineault
Guest
Posts: n/a
 
      1st Apr 2010
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/answer...press-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.



"Sue L." wrote:

> 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/libr...ice.12%29.aspx
> With oEmail
> .To = SendTo
> .Subject = Subject
> .Body = Body
> .Recipients.ResolveAll
> .Save
> .send
>
> End With
> Set oEmail = Nothing
> Set oOutbox = Nothing
>
> Set oApp = Nothing
>
> -------------
>
> Thanks,

 
Reply With Quote
 
Sue L.
Guest
Posts: n/a
 
      1st Apr 2010
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

"Daniel Pineault" wrote:


>
> 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.
>


 
Reply With Quote
 
Mark Andrews
Guest
Posts: n/a
 
      1st Apr 2010
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,

--
Mark Andrews
RPT Software
http://www.rptsoftware.com
http://www.donationmanagementsoftware.com



"Sue L." <(E-Mail Removed)> wrote in message
news:80CC53EA-EDE9-4C45-8D43-(E-Mail Removed)...
> 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/libr...ice.12%29.aspx
> With oEmail
> .To = SendTo
> .Subject = Subject
> .Body = Body
> .Recipients.ResolveAll
> .Save
> .send
>
> End With
> Set oEmail = Nothing
> Set oOutbox = Nothing
>
> Set oApp = Nothing
>
> -------------
>
> Thanks,


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"EITHER THERE IS NO DEFAULT MAIL CLIENT OR THE CURRENT MAIL CLIENT CANNOT FULFILL THE MESSAGING REQUEST. PLEASE RUN MICROSOFT OUTLOOK AND SET IT AS THE DEFAULT MAIL CLIENT" Jon D. Schoenherz Microsoft Outlook Discussion 7 21st Mar 2009 05:43 AM
Re: Third party email client as default mail client Still learning Windows XP General 1 7th Jul 2008 02:28 PM
Send email to default mail client KevinK Microsoft VB .NET 2 16th Sep 2005 06:36 AM
Create Email, attach file and send using default mail client ... Landley Microsoft VB .NET 2 10th Nov 2004 09:17 AM
Send email to default mail client runningdog Microsoft Dot NET 4 2nd Jun 2004 12:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:13 PM.