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

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%28v=office.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,
0
Utf
4/1/2010 3:37:02 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

3 Replies
935 Views

Similar Articles

[PageSpeed] 31

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.



"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/library/bb277434%28v=office.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,
0
Utf
4/1/2010 3:47:02 PM
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.
> 

0
Utf
4/1/2010 4:11:02 PM
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." <SueL@discussions.microsoft.com> wrote in message 
news:80CC53EA-EDE9-4C45-8D43-B8C84B0B0176@microsoft.com...
> 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%28v=office.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, 

0
Mark
4/1/2010 9:27:39 PM
Reply:

Similar Artilces:

Outlook 0x800ccc0d error when Norton e-mail protect enabled: see hosts
This post is made to help others solve this issue, based on my experience. Symptom: - Outlook works perfectly well when Norton Anti-Virus e-mail protection is disabled - Outlook cannot retrieve incoming messages when NAV e-mail protection is enabled, message being: pop3 server not found, error 0x800ccc0d This symptom, and possible solutions, are exactly the object of Symantec support note: http://service1.symantec.com/SUPPORT/nav.nsf/docid/2000020716064206 Please read this note first ! The object of this post is to add another possible solution to this problem. NAV email protection sets up...

How2 set Defaults for Paragraphs in Pub2003
I have just upgraded to Pub2003. My old Pub2000 had no such feature. My problem is when I cut and paste into the new Pub2003 it automaticly uses a Line Spacing default "After Paragraphs: 9pt" - this whacks out all my old logos and forms when they are copy/pasted in to a new Pub2003 .pub If I open an old (2k) .pub file with Pub2003 the spacing is fine - if figures out the Line Spacing is "After Paragraphs: 0pt" ...

Autonumber created.. problems in the future?
I managed to create an autonumber in Microsoft CRM. I did this by making a field "Number"(in the database "New_Number") and I published it on the form. Then I went To the SQL server and I changed the field in the table to Identity Yes, Identity seed 1, Identity Increment 1. I locked the field on the form. It worked! I think that this is not supported by Microsoft. But has anybody got any idea which troubles i could get with this configuration? San ________________________________ Do you know all add-ons for Microsoft CRM? Visit http://www.pimpmycrm.com The biggest dange...

Recieving email with nothing in them? Blank??
From time to time, I will recieve email from friends, family, or business...and when I get the email, I open it up to find nothing but white space. I can't find a common thing between emails. I just know it is very frustrating when I have to ask people to resend the email to me or to a new address. When I look at my mail on the server, it is fine. It is when I open Outlook and it downloads it to my desktop. I get nothing. Any ideas? Cheers.. vg Sorry, wanted to add that I am using OL2003 with WINXP and everything is updated SP wise. I am starting to see some articles on this...

Some Emails Cannot be Delivered
I have a problem that I cannot put a handle on with my exchange server. Some outbound messages do not reach their destination. The problem happens with certain destinations. However the confusing part is that some messages are able to make it through. This would mean that there are no problems with DNS or MX lookup or any connectivity issue since some emails manage to make it through. I'm at a loss and can't figure where to look first I hope that someone might have an idea. You'll have to provide more information. Are you receiving NDrs if so can you share them? Is ther...

Attaching Contacts to new email
Creating a new email. When contacts folder has "shared" contacts and "personal" contacts how can you set your personal contacts as the default? Example: creating a new email having never addressed the "send to" contact before, you hit the "To" button. Currently my "shared" contacts opens up but I would like my "personal" contacts page to open instead of having to drop down to "contacts" to bring up that list. Is there a solution to this? Thank you!!! On 2/26/2010 10:21 AM, assistantneedshelp wrote: >...

Sorting emails by domains, from org to edu (right char is the most significant)
Hello All I need to sort the domains according their emails. For example: Before sorting: john1@abc.edu john3@abc.org john5@abc.com john4@bcd.org john2@bcd.edu john6@bcd.com After sorting: john3@abc.org john4@bcd.org john5@abc.com john6@bcd.com john1@abc.edu john2@bcd.edu That is, how to sort, according to the domain name ( the right is the most significant )? Thanks. Z. D. On Feb 15, 11:09 pm, "duzhid...@gmail.com" <duzhid...@gmail.com> wrote: > That is, how to sort, according to the domain name ( the right is the > most significant )? you'll probably need ...

invalid email address
In message to Candy FH Muffman wrote of having an invalid email address. I use hotmail but would like to prevent ti being used by spammers. Is there any way I can hide it or restrict it in some way? Can I make it invalid? Thank you You mean when posting to an online service like this? Sure, don't type your (correct) email address. See my address or from many others to see an example. Note: I've removed your valid address in my reply. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add...

WCF Client serialization problem
I posted the problem on another forum, and to prevent duplicate posts, but get as many professionals as possible to look at it, I include the url in this post. Please help! http://stackoverflow.com/questions/2948657/migrating-webclient-to-wcf-wcf-client-serializes-parametername-of-method ...

Having problem with spoofing email
Our users just received multiple email from different users outside the company. In the To: line, it shows his user name correctly but when he print those email, the To: line was showing somebody else name on the print out. Is there a way to block this behavior? I'm using E2k3. For some reason our spam (postini) didn't pick up these emails. Thank you, Could you please post the message in raw format (including the mail headers) Petch wrote: > Our users just received multiple email from different users outside the > company. In the To: line, it shows his user name cor...

outlook 97 and express email problems
Hi, I am currently on an IBM X21 laptop and is running windows 98 se with office 97 pro. I recently experienced some problems with outlook (illegal operations etc) and reinstalled office to fix the problem but since then I have not been able to send or recieve emails with outlook 97 and outlook express 6. I simply get an error message saying the host can't be found (but does exist and I can ping it successfully). Any suggestions on what I might do? I have tried creating new accounts in windows mail and outlook express, but I still get the same error. Thankyou in advance! Tim D...

explanation of codes in Visual Basic when creating User form
Hi, I am trying to create a user form in Visual Basic however I'm trying to teach myself by reading/watching tutorials. (www.contectures.o.ca, etc) A lot of the instructions I am seeing simply give the code rather than explain how to actually write one from scratch. So... I need to know what each 'term' means so I can understand how the codes work. Any help is much appreciated :) One of the first codes is for the Add button Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("PartsData") What d...

Moving incoming mail automatically to specific folders.
I have three separate E-Mail Accounts (1,2, and 3) I have created three subfolders under Inbox (Mail1, Mail2, Mail3) How can I automatically get the mail sent to the correct Mail in location (Mail1,Mail2 or Mail3). I am sure the answer like everything is easy when you know how but I have just spent an hour trying! Thanks Ted On Mon, 2 Jan 2006 00:24:44 -0000, "EddyStone" <teds@screaming.net> wrote: >I have three separate E-Mail Accounts (1,2, and 3) >I have created three subfolders under Inbox (Mail1, Mail2, Mail3) >How can I automatically get the mail sent to ...

Certain Keys/Characters not recognised when creating a task
I've just attempted to create a task and the edit control for the subject of the task refused to accept the characters c h s t u and v. I was able to switch to other applications such as a command prompt and internet explorer and type the characters quite happily (so there is nothing wrong with the keyboard) but when I switch back to Outlook it will not recognise them. I'm using Outlook2003 as installed with Office 2003 Professional (SP1 and all other updates applied). As a last resort I closed down Outlook and restarted the program which is now accepting the keys/characters. A...

default values in a cell
Hello, can you help me please Cell B1 contains a complex mathematical formula which requires (in several places) a number from cell A1. Cell A1 can contain any integer number, but it is usually the same (30). I would like to be able to leave cell A1 empty, and only enter a number when it is not 30 , ie the default value of A1 is 30, unless specified. How do I go about this ? Should I look at conditional formatting, or put lots of IF functions into an already complex formula? Thank as always KK Use 2 cells Modify the complex formula to use B1 rather than A1 ( or any other un-u...

How to create an autonumber field?
hi i need to create an autonumber field to automate account numbering. how can i do this? thanx You can do this using a post callout piece of code so when you update an account this code is called which calls back into the platform and works out the last account number then adds one to it and updates the account record. look on msdn.microsoft.com under crm for examples -- John O'Donnell Microsoft CRM MVP http://www.mscrmfaq.us "Max" <Max@discussions.microsoft.com> wrote in message news:0ABFF244-EC0A-48EC-9E76-7CA61E6EBC3A@microsoft.com... > hi > > i need ...

setup Windows Mail as Word 2003 default emailer
All I can do is setup Outlook. I do not use Outlook. I would like to email Word docs using MS Windows Mail (new version of Express) In the Windows Start area, type Regedit into the search bar and then start the Registry Editor and go to HKEY_CURRENT_USER>Software>Clients>Mail Right Click on the (Default) item and then on Modify and in the Value data: field enter Windows Mail so that after you click OK, you have (Default) REG_SZ WIndows Mail -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a pa...

Emails #3
Hi, I was wondering if anyone knew of any web based email provder that I could use that wont be bloked but the I.T Filer at my work. I require use of emails during the day for personal use but work emails are monitored. I have tired various sites i.e Hotmail, Yahoo, Gmail, lycos etc but they are all blocked. Does anyone know of any that may not be picked up buy the web filer. Fiona Fiona, It is difficult to answer because it depends on what your filter is and how it is monitored. For instance, if it is actively monitored and somebody found out you were accessing the site, then it coul...

Outlook 2003 Drag and Drop Emails
I have an issue where there is a SBS 2003 server (newly installed) & when I drag emails to the file system (explorer window) in order to create file records of the emails it generates an error. Dialog Box Name: Error Copying File or Folder Error Msg: Not enough storage is available to process this command. I can't find an error logged anywhere, either on the server event logs or on the local machine event logs... I have searched the MS KB & Office online, but no joy yet... If anyone can help that would be great!!! R ...

Default scene is solid blue but only on one account
I have 2 accounts with WLM, on one the default scene is as it should be, a mix of blue and white. But on the other account it is solid blue. If i change the scene in the program it changes to that but any contact windows i open continue to be solid blue by the persons name but above that is the new scene. I've done a repair job on 2 computers but does not fix the problem. Guesses? ...

Reply To Email after installing CRM Outlook Client
After installing the CRM Outlook Client, when opening an email and selecting REPLY, the current windows looses focus. I know this sounds minor but many of our power users are in the habit of hitting REPLY and typing without even looking at the screen. It is not until they look up do they realize that the window no longer has focus thus everything they thought they typed now has to be retyped. Has anyone seen this and know of a quick fix? Thanks in Advance -- Kenneth Clebak Kenneth Have you resolved this? I have the same problem, and it is VERY annoying. Saira "Kenneth Clebak&...

ERROR: 5.1.2 or other punctuation after the recipient's email address.
I am trying to send a email to a group address I created with 58 addresses in it. When I try to send the email to this group I get the following Error: "5.1.2 or other punctuation after the recipient's email address. " I have gone back to the original contact cards and made sure the addresses were all legal. I have re-created the list, same problem I have re-booted, same thing. Any thoughts out there? Thanks Dunc My wife and I have MBP's and are both running MS Office for Mac's, Entourage 12.2.3. Both of us have messages cued up in the out boxes th...

outlook 2007 e-mail
how do you stop e-mails from automatically downloading when you open outlook 2007. i would like to be able to open outlook 2007 and have it wait for me to select 'receive' before downloading e-mails to my system. i know there is a way to do it in outlook 2003 but i do not remember how to do it there and i cannot find how to do it in outlook 2007. -- emerson Uncheck the option to send/receive at a specific interval. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted w...

OE autodelete OLD mail
How do I have Outlook Express automatically delete 90-Day old messages from the deleted items folder? Thanks, Matthew This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite different program, despite its similar name.. You will probably get a faster and more expert answer if you post this to an Outlook Express news group. Try posting in one of these newsgroups: microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x microsoft.public.windows.inetexplorer.ie55.outlookexpress for OE 5.5x microsoft.public...

q Emailing Excel Sheet With Outlook
I am trying to send a table from Excel within the body of an Outlook (lastest versions) to be sent as a fax. Am able to do this, BUT when the document prints out on the fax machine the formating is off (too big for the sheet). I am flexible on changing the method I send it to the fax machine, however it must be sent to the fax via macro. Below is the code I am using. Any help would be greatly appreciated. David Public Sub DoIt() 'On Error GoTo Handler Dim EmailAddress(0 To 2) As String Dim Count As Integer Dim N As Integer Dim sRec1(0) As String Dim sRec2(0 To 1) As...