Solved

How to determine the default email program

Posted on 2002-06-20
11
167 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

840 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