Open new email window (default email program?)

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Open new email window (default email program?)

Post by Dorian (MJT support) » Thu Feb 12, 2004 5:57 am

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.

Lumumba

Post by Lumumba » Fri Feb 13, 2004 9:23 pm

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?

Guest

Post by Guest » Mon Feb 23, 2004 6:04 pm

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?
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.

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.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Mon Feb 23, 2004 6:08 pm

sorry guys, that last guest was me.

Lumumba

Post by Lumumba » Tue Feb 24, 2004 9:54 pm

Check this registry key and its value on your box: HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail --> Default

How to accomplish your request with Delphi:
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;
Seems not to complicated to "translate" this to VBScript.
Have phun :roll:

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Feb 25, 2004 8:51 am

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
MJT Net Support
[email protected]

Lumumba

Post by Lumumba » Wed Feb 25, 2004 10:33 am

Bingo :lol:

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Fri Feb 27, 2004 7:19 am

Last edited by Dorian (MJT support) on Fri Feb 27, 2004 7:41 am, edited 1 time in total.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Fri Feb 27, 2004 7:28 am

Thanks for your help guys.

However, this points to msimn.exe which of course opens outlook express (my default email client) and not a new email window? Is there somewhere in the registry which would help me do that?

Many thanks.

Lumumba

Post by Lumumba » Fri Feb 27, 2004 10:38 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

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Fri Feb 27, 2004 6:06 pm

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?

Lumumba

Post by Lumumba » Fri Feb 27, 2004 11:09 pm

Was good timing and by the way - a combined effort 8) .

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 :wink:

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 ..]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Mar 03, 2004 2:40 pm

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.
MJT Net Support
[email protected]

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Thu Mar 04, 2004 12:24 am

Thank you guys. I cannot wait to try this out. Did you know your support is the best I have ever encountered from anyone, ever?

Lumumba

CRLF at the commandline ?

Post by Lumumba » Thu Mar 04, 2004 9:57 am

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)
How to accomplish a "body" with multiple lines, directly from the commandline without doing a Send>blabla%CRLF%yadayadayada%CRLF% ...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts