?
Solved

How to determine the default email program

Posted on 2002-06-20
11
Medium Priority
?
180 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…
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…
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

864 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