Hello -
I use a modified version of an AppleScript that I found on the net to respond to incoming messages that contain either a “Disposition-Notification-To” header or “Return-Receipt-To” header. For some senders, the email address content for these custom headers doesn’t match the address in the From header or Reply-To header.
How do I extract the sender and address from a custom header?
Thanks!
Ashok
P.S. My current script is pasted below …
using terms from application “Mail”
on perform mail action with messagestheMessagesfor ruletheRule
try
repeat with theMessage in theMessages
if the source of theMessage contains “Disposition-Notification-To” or the source of theMessage contains “Return-Receipt-To” then
set theSubject to subject of theMessage
set theRecipient to “Username my@email.address”
— extract From and Reply-To names and addresses
set theFromSender to extract name fromsender of theMessage
set theFromAddress to extract address fromsender of theMessage
set theReplyTo to extract name fromreply to of theMessage
set theReplyToAddress to extract address fromreply to of theMessage
if theFromAddress = theReplyToAddress then
set theSender to extract name from sender of theMessage
set theAddress to extract address fromsender of theMessage
else
set theSender to extract name from reply to of theMessage
set theAddress to extract address fromreply to of theMessage
end if
display dialog “Respond to Delivery Confirmation Request?” & return & return & “Sent By: ” & theFromAddress & return & return & “Respond To: ” & theAddress buttons {“Send Response?”, “Cancel”} default button 2 with title “Delivery Confirmation Request” with icon note
— create a new message addressed to theSender at theAddress
set theDate to date sent of theMessage
set nowDate to current date
set theBody to “Your message” & return & return & ” To: ” & theRecipient & return & ” Subject: ” & theSubject & return & ” Sent: ” & theDate & return & return & “was read on ” & nowDate & “. Thank you.” & return
set newMessage to make new outgoing message with properties {subject:“Return Receipt: ” & theSubject, content:theBody & return & return}
tell newMessage
makenew_to recipient_at end of _to recipients_with properties {name:theSender, address:theAddress}
sendnewMessage
end tell
end if
end repeat
end try
end perform mail action with messages
end using terms from
_Источник: discussions.apple.com _Мета слова: _