Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

create e-mail with apple script - I'm looking for a very simple command

Posted on 2011-02-28
4
Medium Priority
?
677 Views
Last Modified: 2012-06-27
Hello!

I need a very simple AppleScript that just creates an e-mail. The command needs to be systemwide and not be dependent on the application Mail being open. I just need a new e-mail window.

I have tried various variations of the shell command
do shell script "mail"

Open in new window


But I always get an error message that one of the characters is missing.

The Windows equivalent of this command is “mailto:". This will always open a new e-mail in the default mail application.

 your help is greatly appreciated!
0
Comment
Question by:speechrec
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
xmlmagician earned 1000 total points
ID: 34995717
try this one
tell application "Mail"
			set theNewMessage to make new outgoing message with properties {subject:"Subject text", content:"Content text", visible:true}
			tell theNewMessage
				make new to recipient at end of to recipients with properties {address:"email address"}
				send
			end tell
		end tell

Open in new window

0
 

Author Comment

by:speechrec
ID: 34995840
I know that one, but I don't want any recipient, subject line or content.
Just a naked email.
The kind of e-mail I want

okay,
I've figured it out, partly at least:
tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true}
end tell

Open in new window


It opens in the background. Is there a way to make it the topmost window?
0
 

Assisted Solution

by:speechrec
speechrec earned 0 total points
ID: 34995927
Okay, I've got it.

tell application "Mail"
	set theMessage to make new outgoing message with properties {visible:true}
end tell
-- Mail in den Vordergrund bringen!
tell application "Finder"
	try
		set frontmost of process "Mail" to true
	end try
end tell

Open in new window


I'll give you some of the points. Thanks for your help!
0
 

Author Closing Comment

by:speechrec
ID: 35042255
I had to figure it out myself. But it was no big deal.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

886 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