Solved

How to determine the default email program

Posted on 2002-06-20
11
163 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
 
LVL 69

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now