Open new email window (default email program?)
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Open new email window (default email program?)
Is there any kind of shell command (dll somehow?) which I can run to open a new email window?
What I really want to do is open a new email window and embed an image into it, and the image would depend on user entered text.
So when the user activates the macro it would ask them for a text string, and when they press enter it would open an email window in whatever default email application they use and insert the image they chose automatically.
Failing that, as long as I can open the default email window I'll write the macro so it looks for the window name of all the major email clients.
But opening an email window is the most important part of my quest right now, so if anyone can help I'd really appreciate it.
What I really want to do is open a new email window and embed an image into it, and the image would depend on user entered text.
So when the user activates the macro it would ask them for a text string, and when they press enter it would open an email window in whatever default email application they use and insert the image they chose automatically.
Failing that, as long as I can open the default email window I'll write the macro so it looks for the window name of all the major email clients.
But opening an email window is the most important part of my quest right now, so if anyone can help I'd really appreciate it.
Because I need to integrate an automatic image insertion into whatever email client they use, but I need the image id tag to edited by the user.Lumumba wrote:So they should choose an image (file) using Macro Schedulers Input> command?
Why you wanna open an EMail client? Why not attach the image directly within the SMTPSendMail> command?
I have a macro for my outlook express installation which performs an "alt I P" for "insert picture" then types the following string :
http://www.2trackit.com/2ti11.gif?999-
Then the user adds his unique ID so he can identify it, such as
http://www.2trackit.com/2ti11.gif?111-j ... msmith.com
But for this to be nice and convenient for the user I need an email window to open for whatever default email app they use, and for the first part of the tag to be automatically entered for them, as it's a bit unwieldy.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Check this registry key and its value on your box: HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail --> Default
How to accomplish your request with Delphi:
Have phun
How to accomplish your request with Delphi:
Seems not to complicated to "translate" this to VBScript.Author: Marcel Verbeek
uses Registry;
procedure OpenMailClient;
const
cMailClient = '\SOFTWARE\Clients\Mail\';
var
reg: TRegistry;
RegClientDefault: string;
begin
reg := TRegistry.Create;
try
with reg do
begin
CloseKey;
RootKey := HKEY_LOCAL_MACHINE;
if OpenKeyReadOnly(cMailClient) then RegClientDefault := reg.ReadString('');
if OpenKeyReadOnly(cMailClient + RegClientDefault + '\shell\open\command') then
WinExec(PChar(ReadString('')), SW_SHOWNORMAL);
end;
finally
reg.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenMailClient;
end;
Have phun

Or in MacroScript:
//What is the default mail client
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail,,DefClient
//Get the default mail client's executable/shell open command
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail\%DefClient%\shell\open\command,ExeCommand
//Run the default mail client
Run>ExeCommand
//What is the default mail client
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail,,DefClient
//Get the default mail client's executable/shell open command
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail\%DefClient%\shell\open\command,ExeCommand
//Run the default mail client
Run>ExeCommand
MJT Net Support
[email protected]
[email protected]
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Last edited by Dorian (MJT support) on Fri Feb 27, 2004 7:41 am, edited 1 time in total.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
...\Outlook Express\msimn.exe" /mailurl:mailto:
or with an distribution list
...\Outlook Express\msimn.exe" /mailurl:mailto:?subject=&CC=;&BCC=;body=Hello World
Sample:
...\Outlook Express\msimn.exe" /mailurl:mailto:[email protected]
-----
same works for newsgroups
... /newsurl:news:///
-----
PC-Welt 03/03
or with an distribution list
...\Outlook Express\msimn.exe" /mailurl:mailto:?subject=&CC=;&BCC=;body=Hello World
Sample:
...\Outlook Express\msimn.exe" /mailurl:mailto:[email protected]
-----
same works for newsgroups
... /newsurl:news:///
-----
PC-Welt 03/03
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
Lumumba, you should quite rightly be king of the world. Thank you *so* much!
This leaves me with ...
//What is the default mail client
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail,,DefClient
//Get the default mail client's executable/shell open command
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail\%DefClient%\shell\open\command,ExeCommand
//Run the default mail client
Run>%ExeCommand% /mailurl:mailto:
Which opens a new email window very nicely. This gives me a great start. I have a couple of questions, if that's okay .....
1. Is there a resource I can look up somewhere? I have been searching on the net for ages and didn't come across that amazing snippet you just gave me. That way I might not have to pester you guys so much.
2. Is there a way to ensure the email which opens is html and not plain text? I suppose I could change that in the registry so *all* emails are html?
This leaves me with ...
//What is the default mail client
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail,,DefClient
//Get the default mail client's executable/shell open command
RRK>HKEY_LOCAL_MACHINE,SOFTWARE\Clients\Mail\%DefClient%\shell\open\command,ExeCommand
//Run the default mail client
Run>%ExeCommand% /mailurl:mailto:
Which opens a new email window very nicely. This gives me a great start. I have a couple of questions, if that's okay .....
1. Is there a resource I can look up somewhere? I have been searching on the net for ages and didn't come across that amazing snippet you just gave me. That way I might not have to pester you guys so much.
2. Is there a way to ensure the email which opens is html and not plain text? I suppose I could change that in the registry so *all* emails are html?
Was good timing and by the way - a combined effort
.
I've reviewed/filtered a bunch of PC Magazines some days ago. This one was slightly about what you've requested so I thought let's give you a try
But it's a standard - every week you'll find something like "Microsoft secrets" in a PCMagazine @ a store near you. So, as its Microsoft you should find something @ their support area (keywords: , parameters, switches) as well.
html as default? Log with "RegShot" which regkey has changed - right after you've done it on the OE frontend [more ..]

I've reviewed/filtered a bunch of PC Magazines some days ago. This one was slightly about what you've requested so I thought let's give you a try

But it's a standard - every week you'll find something like "Microsoft secrets" in a PCMagazine @ a store near you. So, as its Microsoft you should find something @ their support area (keywords: , parameters, switches) as well.
html as default? Log with "RegShot" which regkey has changed - right after you've done it on the OE frontend [more ..]
Before you get too excited I think that this command line extension might just be an Outlook/Microsoft thing. What if your user doesn't have Outlook as his default client. I just tried this /mailurl:mailto:[email protected] with PocoMail and it didn't do anything besides open PocoMail.
However, Email clients use a standard called MAPI. That's how Windows knows which mail client to open and how to open a new message.
The following will use keystrokes and MAPI to open a new email message:
Press CTRL
Press Esc
Release CTRL
Send>r
WaitWindowOpen>Run
Send>mailto:[email protected]?subject=Help!
Press Enter
Or *far* more elegant:
VBSTART
Sub NewEmail(recipient,subject)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mailto:" & recipient & "?subject=" & subject
Set WshShell = Nothing
End Sub
VBEND
VBRun>NewEmail,[email protected],Testing
Each of these opens a new message with the recipient and subject lines filled in.
However, Email clients use a standard called MAPI. That's how Windows knows which mail client to open and how to open a new message.
The following will use keystrokes and MAPI to open a new email message:
Press CTRL
Press Esc
Release CTRL
Send>r
WaitWindowOpen>Run
Send>mailto:[email protected]?subject=Help!
Press Enter
Or *far* more elegant:
VBSTART
Sub NewEmail(recipient,subject)
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mailto:" & recipient & "?subject=" & subject
Set WshShell = Nothing
End Sub
VBEND
VBRun>NewEmail,[email protected],Testing
Each of these opens a new message with the recipient and subject lines filled in.
MJT Net Support
[email protected]
[email protected]
- Dorian (MJT support)
- Automation Wizard
- Posts: 1415
- Joined: Sun Nov 03, 2002 3:19 am
CRLF at the commandline ?
mailto:[email protected]?subject=Help!&CC=[email protected];[email protected]&BCC=[email protected]&body=Hello World
I've got this in Outlook (which is fine)
I've got this in Outlook (which is fine)
How to accomplish a "body" with multiple lines, directly from the commandline without doing a Send>blabla%CRLF%yadayadayada%CRLF% ...TO: [email protected]
CC: [email protected]; [email protected]
BCC: [email protected]
Subject: Help!
Hello World