Jump to content

Seeking "run" method for email client


qwert
 Share

Recommended Posts

If I want to initiate an email from a script, I can just ShellExecute a file like Draft.eml to open a compose window ... IF there's an email client installed, of course.

But what if I just want to open a general use window on the desktop for that same client? ... to read new emails, for example.

Is anyone aware of a general "run" command that doesn't require knowing which client is installed (i.e., like when eml's start the registered client, whatever it is)?

Thanks in advance for any suggestions.

 

 

Link to comment
Share on other sites

I think ShellExecute should be the way to go. If needed you can specify the "verb" parameter to define the action to be executed when the mail item is being opened.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

ShellExecute ... but what?

I don't know the identity of the email client ... and draft.eml opens a compose window, which I don't want.  What "verb" would open the whole of the client and not a specific email message? (which I don't know, either)

If I've missed your point, I apologize.  And if there's no known way, that's OK.  But it's a feature I need to figure out, so I had to ask.

Worst case, I may have to open draft.eml hidden ... and then then try to figure out what's running to support it.  But I'd prefer a direct method, of course.

Thanks for your response.

 

 

 

Link to comment
Share on other sites

Looks like the mail programs are stored in the registry: Search HKEY_LOCAL_MACHINE\Software\Clients\Mail. The default mail program seems to be flaged. Extract the program name and pass it to ShellExecute.
Sorry to not be more specific, but I have no Windows system available right now.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Another idea: What does

Shellexecute("mailto:")

return?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Search HKEY_LOCAL_MACHINE\Software\Clients\Mail

Good idea.  I looked that up and found this on  stack overflow

... with this suggestion:

Better to read HKEY_CURRENT_USER\Software\Clients\Mail. (But) this only gives you the name of the email application. If you want its executable file name, you have to go on with something like;

object mailCommand = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\" + mailClient.ToString() + @"\shell\open\command", "", "none");

and then remove anything extraneous from the command-line string that you don't need (quotes, parameters).

 I'll work toward a RegRead() equivalent.

Thanks.

 

Link to comment
Share on other sites

Well, I've located the proper value (the actual run command) ... but the key path name of "Mozilla Thunderbird" presents a problem, since I don't know ahead of time what it might be ... and there could be multiple clients, I suppose.

Can someone offer a suggestion?

 

Registry_Key.thumb.png.98d7f87a9482985a7

Read_Result.thumb.PNG.64c388f2c3e990c54f

Link to comment
Share on other sites

  • Moderators

Like this. The problem you're going to run into is you will always have some default clients in that list. Even on a brand new install I have Hotmail and Windows Mail. You would have to disregard those unless they're the only entries.

Local $sSubKey = ""
For $i = 1 to 10
    $sSubKey = RegEnumKey("HKLM\SOFTWARE\Clients\Mail", $i)
    If @error Then ExitLoop
    ConsoleWrite($sSubKey & @CRLF)
Next

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...