Re: Recycling Email Drafts in Mail
Re: Recycling Email Drafts in Mail
- Subject: Re: Recycling Email Drafts in Mail
- From: Bruce Brown <email@hidden>
- Date: Thu, 26 Mar 2009 19:28:44 -0700
Oops! I accidentally sent this directly to James, instead of to the
list, so I'm re-sending it. My apologies to James (who will see this
twice).
Hi James,
My AppleScript skills being primitive at best (at least, so far), I
can't (yet) comment on the details of how to script Apple's Mail app.
But, I *can* comment on some aspects of how the Mail app works when
it's controlled by a human; hopefully, that info plus help from
others on this list will be enough for you to write a working
AppleScript (or, possibly, to convince yourself that it's impossible,
if that turns out to be the unfortunate case).
Here's what I know:
When you start a new Mail message (File > New in Mail), Mail needs to
decide which Drafts subfolder to store the draft version into, should
you click "Save" while composing the message before clicking on
"Send." (If you compose a new message, then immediately click on
"Send," then there's no copy saved to the Drafts folder; the message
is just sent immediately.) There's a Mail preference that controls
this behavior:
Mail app > Mail menu > Preferences > Composing tab > Addressing:
Send new mail from: drop-down menu.
The choices on this drop-down menu are: either one of your specific
email accounts (such as your Gmail account in your case), or "Send
new mail from the account of the last-viewed mailbox."
There's also a similar drop-down menu that appears in the new message
window, just above the body text part of the window. That drop-down
menu is initially set according to how the drop-down menu in the
Composing preferences is set. But, you can override it for a specific
message by using the drop-down menu in the new message window.
I don't know (and haven't checked the AppleScript Dictionary for
Mail.app) if any of the above things are AppleScript-able, but if
they are, then it seems to me like you should be able to do what you
want, either by setting the preferences in your script, or by
selecting the account in your script, each time the script creates a
new message.
Once the account has been set (either explicitly in your script, or
set by default), the message then should be saved in the subfolder
for that account within the Drafts folder.
One tip that might help: You might find it necessary to make a
"dummy" change to a new message, in order to "trick" the Mail app
into seeing it as a change. That could be entering a space character
(or other character) into your message somewhere, then immediately
deleting that character. The message is then, in effect, unchanged,
but Mail will see the edits as a "change" and will save the message
into the Drafts sub-folder when you click "Save" (or the AppleScript
equivalent of "Save").
-B.
On Mar 26, 2009, at 10:56 AM, James Cook wrote:
I've got an AppleScript for Eudora that works for sending pre-
written email to a recipient from my database.Is there a way to do
this with Apple Mail? I want to save a Draft to use whenever, so
the original needs to remain in Drafts, but I want to open, address
and send a copy.
Because I have multiple accounts, I can't seem to save into the
Drafts folder itself. Mail has a separate folder for each within
Drafts. In my case I'm trying to utilize a message in Drafts:Gmail
Apple's Mail.app has Send Again available in the Message menu, but
I found nothing in its library to indicate I can Send Again via
AppleScript.
Here's what works in Eudora. Rcpnt is assigned the value of the
Email Address from my database. Fdbck returns with the AppleScript
Result showing either the subject on a successful send, or the
error on a failure.
set Rcpnt to $«Email Address»$
tell application "Eudora"
try
send again last message of mailbox "Templates"
set Fdbck to subject of message 0
set field "to" of message 0 to Rcpnt
queue message 0
set Fdbck to Fdbck
end try
end tell
Thanks in advance for any and all suggestions.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden