I've been working on this receipts issue and I'll try to lay out what I've 
done. I am now able to request receipts, reply to a request for a receipt (only 
tested on sending to myself), check to see if requesting receipts is turned on 
and off, and turn requesting receipts on and off.

Disclaimer: I'm not responsible if you accidentally delete already existing 
email headers or have other problems with email, terminal or anything else on 
your computer or in your life :-) while doing this, though of course I'll be 
willing to help troubleshoot if you post problems to the list. This is my first 
draft and though I've looked through it for errors, there's certainly the 
possibility - the overwhelming probability! - I've made some. So if in doubt, 
check things over, ask questions, and do your own research. The links where I 
got most of this information are at the bottom of this email, just above my 
signature. There are plenty of people on this list who will spot errors and 
probably find easier ways to do this. I didn't attempt to include in-depth 
instruction about terminal or applescripts. None of what is written here is 
original with me.

Mac OS version: These instructions are specifically for Mountain Lion. They may 
be used in earlier releases of Mac OS but there will be differences. For 
instance, there have been changes in the location of applescript folders in 
Mountain Lion.

Before we start, a note about copying and pasting: Be careful to get all the 
content as there are apostrophes, braces, semicolons, etc. that really are a 
part of the line to be copied and pasted. If you copy a line by doing 
shift-down-arrow, this could result in the line being put in terminal and enter 
being executed before you have a chance to check the line, so if you want to be 
able to check what you've done, highlight from left to right, making sure you 
include everything. I know that working with terminal can be a challenge with 
voiceover; I have the benefit of a braillelite with brltty in Terminal so if 
you have problems, do some research and/or ask for help on the list. Also, I 
will be referring to the return/enter key as enter. Those with older Macs may 
have both, but it's my understanding that all the newer keyboards now just have 
return. But I don't want to have to write return/enter all the time and the 
term "enter" seems to get used more though they are not identical and the key 
on most Macs is now really return, so if you have both and one doesn't work, 
try the other.

Step 1. Checking for headers:

Since sending receipt requests involves adding something to your email headers, 
first you want to check to see whether you presently have any custom headers 
and what they are. This is done with one line that you can paste into terminal 
and then press enter. The line is:

defaults read com.apple.mail UserHeaders

Step 2. Enabling request receipts for the first time

Note: it is possible to just wait and do this with the applescripts in Step 3 
but it may be better to do it this way the first time to ensure that there are 
no problems.

A. If in Step 1 you get something like:
The domain/default pair of (com.apple.mail, UserHeaders) does not exist":
that means you don't have any custom headers. If that is the case, things are 
simpler because you have nothing you have to keep from deleting. In that case, 
type or paste the following line in terminal, replacing Name with your name and 
email.address with your email address:

defaults write com.apple.mail UserHeaders '{"Disposition-Notification-To" = 
"Name <email@address>"; }'

You shouldn't see any results from this line's entry. You can check to make 
sure the Disposition-Notification-To header was added by running the line in 
step 1 again. If these are the only lines you have just done in terminal, you 
can easily get back up to the first entry from step 1 by arrowing up twice in 
terminal. You won't hurt anything if you accidentally do the line from this 
step over but you won't see any results.
You won't have to type or paste to turn this on and off each time as we will be 
using apple scripts or other alternatives for that. Skip to step 3 if you 
completed 2A successfully.

2B. If the line you entered in Terminal in step 1 gives you something that has 
a line with a left brace and the beginning and a right brace at the end, it 
means that you do have some custom headers which you may not want to delete in 
the process of adding what you need to generate receipt requests. Here's an 
example of what you might get (this is only an example; what you get will vary 
according to your custom headers):

{Bcc = "b...@example.com"; }

In this case you have two choices to proceed. One, which I haven't tried, would 
be to edit the .plist and add in the header. You can find more about this by 
following the link where I got most of this information, which will be at the 
bottom of this email. However, this may have changed somewhat because I notice 
that the path to the .plist given in the article does not exist on my computer. 
Your second alternative would be to do a terminal command that inserts the new 
header without deleting the ones that are already there. Here's how to do this.

1. Highlight the line that was the result of your terminal entry.
2. Do command-c to copy.
3. Type the following line but do not press enter yet and do not use copy and 
paste to put this line in terminal because you will lose the line you just 
copied).

defaults write com.apple.mail UserHeaders '

4. Without spacing, do command-v. This will copy the already-existing header 
information onto the line.
5. In front of (to the left of) the closing right brace, insert the following, 
replacing name with your name and   email@address with your email address.

 '"Disposition-Notification-To" = "Name <email@address>"; '

Here's an example of what the line might look like:
defaults write com.apple.mail UserHeaders '{Bcc = "b...@example.com"; 
"Disposition-Notification-To" = "Heinz Tschabitscher <sen...@example.com>"; }'

6. You may want to do a command-a and command-c to copy this line you have just 
created for two reasons. First, you can paste it into a text editor to check 
for errors if you have a problem. Secondly, this line could be useful in 
turning receipts on and off, which will be discussed in step 3.
7. Now press enter.
If there are no error messages, you have added the new header without deleting 
the other ones.
8. If you copied the line before pressing enter, save it to a text file.
9. You can check this by typing or pasting the line from step 1 in terminal and 
pressing enter and reading the results.

Alternatively, if you have trouble with all the typing, finding your place and 
pasting in terminal, you might be able to do all these instructions in this 
step by constructing the line in Text Edit and then copying and pasting the 
whole line in terminal. But remember that you do have to get that result 
message from step 1 included in your line as described. Then, as just stated, 
you can check your success by running the line from step 1 again.

If I understand correctly, those who have completed these steps successfully 
should be able to send receipt requests. Next, we will discuss turning receipt 
requests on and off.

Step 3. Turning request-receipts on and off.
There are a couple of alternatives for turning receipts on and off. You can use 
apple scripts or you can use a line pasted into terminal or placed in a simple 
shell script (not the same as an apple script). Read through the alternatives 
and pick the one you want to do or see if you can come up with another one.

Alternative 1: Apple scripts
First a warning: I know this works if Disposition-Notification-To is the only 
header. If you have other headers, you may have to modify this to keep your 
other headers from being deleted when you turn off receipts as they would of 
course not be replaced again with the "turn on" script; it would only add back 
the Disposition-Notification-To header. So if you have additional headers, 
research this before using either of these scripts and have a .

Here are the two  scripts to turn receipts n and off. You should copy them and 
paste them into the applescript editor which is in /Applications/Utilities. 
Replace email@address with your email address. Compile and run them to make 
sure they work. If you get a syntax error check your lines; especially in the 
"turn on" script, the middle second line could possibly get chopped up when 
pasting. Do not remove the backslashes. I saved mine as apps. If you do this, 
do not check "run startup screen". However you save them, don't check "run 
only" if you ever want to be able to open and edit them again in the editor. I 
copied these into ~/Library/Application Scripts/com.apple.mail though I don't 
know if that is really necessary. It made sense to me to put them there.

Here is the script to turn on receipts:
tell application "Finder"
        do shell script "defaults write com.apple.mail UserHeaders 
'{\"Disposition-Notification-To\" = \"<email@address>\"; }'"
end tell

Here is the script to turn off receipts:
tell application "Finder"
        try
                set rc to do shell script "defaults delete com.apple.mail 
UserHeaders"
        on error
                return
        end try
end tell

The link I got this info from talked about giving the scripts names that would 
allow you to call them with ctrl-g and ctrl-c but that didn't work for me. I 
saved them as apps and for now put them in the dock. However, they could be run 
in terminal with the osascript command or they could be matched in keyboard 
commander with an option-key combination.

Alternative 2: Line to be pasted in terminal or shell script to be run in 
terminal
A. If Disposition-Notifications-To is your only header (you did step 1 and 2A:
To turn on receipt requests, you can paste the line you used in step 2A into 
terminal or you can create a shell script by:
1. opening a file in Text Edit or other (you will want to make it plain text).
2. Save the file to your user directory or somewhere in your path.
3. Type: chmod +x filename (substituting your file's name for the file and 
including the path if it isn't in the top level of your user directory).
4. Run shell script by typing:
./filename (notice the dot and of course substitute your file's name) if it is 
in the top level of your user directory;
the path to the folder if it is in a subdirectory;
or the name of the file if you have put it somewhere where it can be found when 
you type it: /usr/bin or, if you have one, /usr/local/bin, would be examples of 
this. Look for information on terminal if you want to know more about this.

To turn off receipts, you can use the following line in the ways just described:
defaults delete com.apple.mail UserHeaders


B. If you have other custom headers besides the Disposition-Notification-To 
header (you did steps 1 and 2b:
To turn on receipts:
Use the line you created and entered into terminal in step 2b in the ways shown 
above.

To turn off receipts:
Use the line you created in step 2B without the piece you inserted in step 2B5. 
In other words, remove:
 '"Disposition-Notification-To" = "Name <email@address>"; '
(where name is your name and email.address is your email.

You should now be able to request receipts and turn receipt requests on and 
off. Next, we will discuss how to do a check to see whether you have receipt 
requests turned on or off.

Step 4. Checking/confirming that receipt requests are turned on or off
You can't remember whether receipt requests are turned on or off! Or you are 
sure you turned them off but you are getting receipts back! Or you are sure you 
have receipt requests turned on but no receipts are coming back. Here's how you 
can check whether receipts are on or off.

Type or paste in terminal the line you used in step 1:
defaults read com.apple.mail UserHeaders

Depending on your headers situation, the results will be as follows:

If you get something like:
The domain/default pair of (com.apple.mail, UserHeaders) does not exist":

you have no custom headers and so you know receipt requests are turned off.

If you get anything with a left brace at the beginning and a right brace at the 
end, and Disposition-Notification-To is anywhere in the line, you have receipt 
requests turned on.

If you get a result that does have a left brace at the beginning and a right 
brace at the end but nothing about Disposition-Notification-To, some headers 
are enabled but your receipt requests are turned off.

If you get an error or nothing, you have typed the command incorrectly or 
something is wrong.
You can create a shell script to check this similar to what I described in step 
3.

Step 5. Return receipts applescript

The "return receipts" applescript allows you to send a receipt if it is asked 
for. You can download the script from:
http://hints.macworld.com/dlfiles/mail_rr_scpt.txt

This link takes you directly to the file but you will be in the file rather 
than downloading it. Do a command-l and make sure voiceover says "contents 
selected". Then hold down the option key and press enter while holding down the 
option key. You won't hear anything different but the file should be in your 
Downloads folder after you do this. Notice that it has a .txt extension. I 
didn't have to run this through the apple script editor. I just pressed enter 
on the filename and deleted the .txt and hit enter. Actually I renamed the file 
to Return Receipts.scpt. I was asked whether I wanted to delete the .txt 
extension when I pressed enter after editing the filename.

Place the script in your user directory, not in the system library: 
the path is ~/Library/Application Scripts/com.apple.mail

This AppleScript is called by the mail rule we will create in the next step and 
generates a simple message that says the message was received. 
The AppleScript, as written, doesn't automatically send the message; it creates 
the message, but the user is still required to Send it.
There was a script written that would send invisibly but I didn't do anything 
with that. There was one comment from somebody who had trouble with it and 
there was also a comment about an automatic receipt possibly sending a 
confirmation to spam email so I'll let everybody sort that out for themselves.

6. Mail Rules
In order to respond to receipt requests, you will have to create a rule in Mail.

A. Open Mail and do command-comma to go to Preferences.
B. Do vo-space on Rules in the toolbar.
C. Do vo-space on add rule.
D. In description, type something like: read receipt requested
E. Under criteria, choose the "add headers" choice, click "add" and type:
Disposition-Notification-To in the text field.
Do vo-space on ok.
Then open the pop-up and choose the Disposition-Notification item that you just 
added.
F. Choose contains.
G. Write @ (the at sign) in the criteria field for contains.
H. Do vo-space on add criteria.
I. Select subject.
J. select does not contain.
K. Type Return Receipt in the text field.
(This second criterion prevents you from getting into a never-ending loop of 
requested receipts if you send an email to yourself.
L. Under Perform the following actions:
choose "run applescript" from the pop-up.
Choose the applescript you just put in ~/Library/Application 
Scripts/com.apple.mail.
Do vo-space on ok.
Do not tell mail to perform action on mailboxes if asked (not exact wording).

References and further information
The first link I found was the one Teresa posted:
http://email.about.com/od/macosxmailtips/qt/et_request_recp.htm
By following a link on that website, I ended up at this website:
http://hints.macworld.com/article.php?story=20050512155856402

You will want to read thoroughly, including the comments. But keep in mind that 
people in their comments are referring to Tiger and Snow Leopard so some things 
may not work and some paths have definitely changed. But what I took from this 
website is working for me.

Hth.

-- 
Cheryl

May the words of my mouth
and the meditation of my heart
be acceptable to You, Lord,
my rock and my Redeemer.
(Psalm 19:14 HCSB)



-- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To post to this group, send email to macvisionaries@googlegroups.com.
To unsubscribe from this group, send email to 
macvisionaries+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/macvisionaries?hl=en.

Reply via email to