Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Generate 'Read Receipts' in Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Generate 'Read Receipts' in Mail.app
Authored by: Ody on Sep 06, '06 05:20:56AM

I think I found another way to convince Mail to request return receipts.

(*
This script is based upon the Standard Apple Script "Create New Mail" located in the folder
/library/scripts/mailscripts. I have deleted the unneccesary parts (at least for this purpose).

As in the original script, the modified script asks to select the account from which the email
should be sent. The rest of the procedure is pretty much the same as the original.

The only "innovation" you see in line 22. Since we know the sender through the selection procedure,
I afterwards added a line break and then the required headerline (Disposition-Noticiation-To:)
together with the senders email that we already know. Please take care that theSender that
comes out of your address book doesn't contain single or double quotation marks. In this case
the mail will be sent out but the recipient will see no receipt request.

If this works well, you will see something strange in your Sent items mail folder. The sender
shows up like: YOUR_NAME DISPOSITION_NOTIFCATION_TO: YOUR_NAME YOUR_MAILADDRESS

I think that mail.app misinterpretes the header due to some unknown internal reasons. It's
still a valid Email that you can resend and forward to others.

The last things you then have to do is just to add two new rules: one for your Sent items Box
and the other one for the Inbox.

To mark the mails where you have requested a Notification just build a rule that checks
if the sender contains a string like Disposition-Notification-To: and clour it as you like.

For the Inbox you have add within "Create New Rules" a new Headerline named "Disposition-Notification-To"
and then check if this headerline contains an @-sign. Thats it.

This is an example for "New Email & Receipt" If you want to be perfect you can do the same with
"Answer & Receipt", "Answer to All & Receipt" and "Forward & Receipt" and by using i.e. iKey2
you can run those scripts from an external menu or Hot-key. If you like you can try to start the
script(s) from within Mail Act-On. But my Apple Mail always crashed when I tried to do this.

This has been tested on Intel Mac under 10.4.7 together with Exchange 2003, Exim and Postfix

Good luck - Ody

*)


tell application "Mail"
set listOfSenders to {}
set everyAccount to every account
repeat with eachAccount in everyAccount
set everyEmailAddress to email addresses of eachAccount
if (everyEmailAddress is not equal to missing value) then
repeat with eachEmailAddress in everyEmailAddress
set listOfSenders to listOfSenders & {(full name of eachAccount & " <" & eachEmailAddress & ">") as string}
end repeat
end if
end repeat
end tell

set theResult to choose from list listOfSenders with prompt
"Which account would you like to send this message from?" without multiple selections allowed
if theResult is not equal to false then
set theSender to item 1 of theResult
tell application "Mail"
set newMessage to make new outgoing message with properties {}
tell newMessage
set visible to true
set sender to theSender & return & "Disposition-Notification-To: " & theSender
end tell
activate
end tell
end if



[ Reply to This | # ]
Generate 'Read Receipts' in Mail.app
Authored by: wallybear on Jan 25, '08 02:05:35PM

Almost correct, but sender address is malformed (and some mail servers reject the email, as I verified).

To solve the problem (and get correct sender headers also in your Sent box) replace the following line:

set sender to theSender & return & "Disposition-Notification-To: " & theSender

with this one:

set sender to theSender & ASCII character(10) & "Disposition-Notification-To: " & theSender

The header lines are separated by chr(10), not chr(13) (the return you originally put in that line). This explains why you got strange sender headers in your Sent box, and why some mail server reject so formed messages.

With the above correction, it worked like a charm.



[ Reply to This | # ]