• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
visual email reply SOLUTION
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

visual email reply SOLUTION


  • Subject: visual email reply SOLUTION
  • From: Adam Morris <email@hidden>
  • Date: Tue, 31 Mar 2009 22:15:25 +0900

Okay I think I figure it all out now. There were quite the number of workarounds to make which I'll go into at the end.

Take the following steps in order to set up Mail to respond to an email with a specific subject header (for the purposes of this, we'll use "request brochure"), adding images, a cc recipient, an attachment, and even HTML for the truly adventurist.

1) Set up the perform mail rule action so that subject condition "request brochure" is met, which links to the following script:

property nameofAutomatorApp : "Reply to Request Brochure" -- must be saved in Applications folder!

using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application nameofAutomatorApp to launch -- or use Finder's open method to launch the app
end perform mail action with messages
end using terms from

2) Open Automator, search for "Run Applescript" and drag that workflow in the right side panel. Then paste in the following script (replacing everything else there), and save it (a) as an application, and (b) call it "Reply to Request Brochure" and (c) in the Applications folder. All three things must be done correctly. Notice you can change the script's behavior a bit by modifying the "please" properties at the top, they are all off by default.

property subject_criteria : "request brochure"

property please_auto_send : false

property please_cc : false
property cc_address : "email@hidden"

property please_add_attchment : false
property file_attachment_path : (path to desktop folder) as string

property path_to_library : (path to library folder from user domain) as string -- this must be a string

on run
set targetMessages to {}
tell application "Mail"
set allunread to every message of inbox whose read status is false


ignoring case
repeat with thisunread in allunread
-- !!!! Modify this as needed! !!!!
if subject of thisunread contains subject_criteria then copy thisunread to the end of targetMessages
end repeat
end ignoring


if targetMessages is not {} then
set oldSignature to selected signature


-- !!!! This sets the signature !!!!
set selected signature to "Reply to Request Brochure"


repeat with thisMessage in targetMessages
set towho to reply to of thisMessage
set newone to make new outgoing message with properties {visible:true}
tell newone
set subject to "RE: " & subject_criteria
make new to recipient with properties {address:towho}


if please_cc then make new cc recipient with properties {address:cc_address}
if please_add_attchment then make new attachment with properties {file name:file_attachment_path}
if please_autosend then send it
end tell


set read status of thisMessage to true
end repeat


try
set selected signature to oldSignature
on error
-- if it reaches here then there's a bug where it returns the plist unique ID rather than the name ... workaround is here
set p_file to (path_to_library) & "Mail:Signatures:" & "SignaturesByAccount.plist"


set findnameofsig to ""


tell application "System Events"
tell property list file p_file
tell contents
set whatisinside to value of property list item "AllSignaturesKey"
repeat with thisone in whatisinside
if |SignatureUniqueId| of thisone is oldSignature then set findnameofsig to |SignatureName| of thisone
end repeat
end tell
end tell
end tell
if findnameofsig is not "" then
set selected signature to findnameofsig
else
error "Could not find signature"
end if
end try
end if


end tell
end run

3) Download and install SignatureProfiler http://www.littleknownsoftware.com/sigpro/
Quit Mail and relaunch, and then go to the Signatures preferences. You now have the ability to add images (which must be on the web), and even HTML (instructions are on the website for this) to your signature by right-clicking. We are going to use a custom made signature as the main content.

4) In the Signatures preference, create a signature called "Reply to Request Brochure" and drag it to the "Main" icon. Modify to your heart's content, using the SignatureProfiler's instructions to do it. You can either add inline images or else go for full-blown HTML.

5) Test it to see if it works by sending yourself an email with subject "request brochure." The default behavior simply sets up a reply, but does not send with the information you put into the signature.

Check out the workarounds:

* Mail doesn't let you send emails from within a perform mail rule action, so you have to use an Automator application. For some reason, a Script Editor application does NOT work!

* Mail doesn't let you put in input inline images but the SignatureProfiler plug-in does

* Mail has a bit of a bug when it comes to remembering which signature it was on last so the script has to get in there with the dirty laundry and look at the plist file directly so that it doesn't cause any erratic behavior.

Hopefully we can say this problem is solved now?

-Adam Morris



twitter.com/brainysmurf

 _______________________________________________
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

  • Prev by Date: Re: Recycling Email Drafts in Mail
  • Next by Date: MacWorld Expo
  • Previous by thread: Keynote slide items
  • Next by thread: MacWorld Expo
  • Index(es):
    • Date
    • Thread