Solved

How to determine the default email program

Posted on 2002-06-20
11
168 Views
Last Modified: 2010-05-02
How to determine the default Email program running in the system (i.e, Microsoft Outlook, Outlook Express) in VB.
I am developing one application and I want to include this functionality by just clicking a single Button then the program will automatically open the default Email Software.
Any help would be much appreciated. Thank you.
0
Comment
Question by:arnoldgh
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7097816
Hi Arnoldgh,

a popular approach in this VB TA is to implement independent mail client functionality with this component

http://www.freevbcode.com/ShowCode.Asp?ID=109

HAGD:O)Bruintje
0
 

Author Comment

by:arnoldgh
ID: 7098285
Thank you Bruintje, your suggestion would be very useful for customized emailing system, but in my case, I simply just need
to run or open up the default Email Software so the user can have options to send, receive emails or manage addresses, etc. I don't want
it to automatically run the email send option.

Regards,
arnoldgh
0
 

Author Comment

by:arnoldgh
ID: 7098287
Thank you Bruintje, your suggestion would be very useful for customized emailing system, but in my case, I simply just need
to run or open up the default Email Software so the user can have options to send, receive emails or manage addresses, etc. I don't want
it to automatically run the email send option.

Regards,
arnoldgh
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7098336
Use "mailto:"

' Form1
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd _
  As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As _
  String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Form_Click()
  Dim ret As Long, mailInfo(0 To 4) As String
  mailInfo(0) = "aaa@aaa"
  mailInfo(3) = "Report for %D"
  mailInfo(4) = "Hi, I'm sending report for %D.  Regards, "

  ' open 'new message' in OE
  ret = ShellExecute(Me.hwnd, vbNullString, _
      "mailto:" & mailInfo(0) _
      & "?CC=" & mailInfo(1) _
      & "&BCC=" & mailInfo(2) _
      & "&Subject=" & Replace(mailInfo(3), "%D", Format(Date, "dd.mm.yyyy") & _
          " (" & WeekdayName(Weekday(Date, vbMonday), , vbMonday) & ")") _
      & "&Body=" & Replace(mailInfo(4), "%D", Format(Date, "dd.mm.yyyy") & _
          " (" & WeekdayName(Weekday(Date, vbMonday), , vbMonday) & ")") _
      , vbNullString, "c:\", 1)
0
 

Author Comment

by:arnoldgh
ID: 7102673
Hi emoreau,
    Thank you for your suggestion, but, is there a way that I will be able to detect the default email program (say in the windows registry) so that I can execute it (as if I'm just clicking on the program Icon on the Start Menu to open it up). I simply want to open the default email software and not automatically sending a mail.

Thanks and regards,
arnoldgh
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7102689
Hi Aronldgh, you can also look at this snippet

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=969&lngWId=-10

HAGD:O)Bruintje
0
 

Author Comment

by:arnoldgh
ID: 7102718
Hi emoreau,
    Thank you for your suggestion, but, is there a way that I will be able to detect the default email program (say in the windows registry) so that I can execute it (as if I'm just clicking on the program Icon on the Start Menu to open it up). I simply want to open the default email software and not automatically sending a mail.

Thanks and regards,
arnoldgh
0
 
LVL 1

Accepted Solution

by:
tetrode earned 100 total points
ID: 7103785
see HKEY_CLASSES_ROOT\mailto\shell\open\command
0
 

Author Comment

by:arnoldgh
ID: 7104073
I would like to thank bruintje and emoreau for your effort and suggestions, however I would like to give the points to tetrode as his suggestion was actually what I'm looking at. Thank you very much guys.

Regards,
arnoldgh
0
 
LVL 1

Expert Comment

by:tetrode
ID: 7110034
Thanks! - BTW you will need to do some parsing there - be sure that you cover all possibilities.

Mark
0
 

Author Comment

by:arnoldgh
ID: 7112714
understand, yes I will. Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Passing a Text Box name to a Sub 6 102
converting visio 2010 to powerpoint 2010  - formatting issues 5 109
Automatic Email Reminder 4 78
backup program with robocopy 6 76
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question