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


Click here to return to the 'Send one email to the senders of multiple Mail messages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Send one email to the senders of multiple Mail messages
Authored by: morespace54 on May 28, '07 08:52:39AM

That's all fine and working great! Thanks...

What I would really like, would be the same script but with all the recipents to appear in the "Bcc" field (instead of the "To"). This way, each recipient would not have the list of all the other 150 recipents addresses... I'm new to AppleScript but I've managed to to change the line "make new to recipient with properties" with "make new bcc recipient with properties" but it's seems I can't figure out how to put myself as the default "To" (even hard coded in the AS, but a pop-up or a list of accounts would be even better)...

Maybe one day, I'll figure it out...



[ Reply to This | # ]
Send one email to the senders of multiple Mail messages
Authored by: morespace54 on May 31, '07 01:38:50PM

Okay here is my flaky solution:


<code>
set thesenders to {}
set thesenderstext to ""
--
set theName to ""
--
set theSubject to ""

set my_result to display dialog ¬
"Subject:" default answer theSubject ¬
buttons {"Cancel", "Continue"} default button 2
set theSubject to the text returned of my_result
--
set myaddress to ""

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 my_result to choose from list listOfSenders with prompt ¬
"Which account would you like to send this message to?" without multiple selections allowed
if my_result is not equal to false then
set myaddress to item 1 of my_result
end if
--
set myAccount to ""

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 my_result to choose from list listOfSenders with prompt ¬
"Which account would you like to send this message from?" without multiple selections allowed
if my_result is not equal to false then
set myAccount to item 1 of my_result
end if
--

tell application "Mail"
set themessage to the selection
repeat with i from 1 to the number of items in themessage

set thesender to (extract address from (the sender of (item i of themessage)))

if thesenders does not contain thesender then
set thesenders to thesenders & {thesender}
end if
end repeat
set AppleScript's text item delimiters to ", "
set thesenderstext to thesenders as text

set newMessage to make new outgoing message with properties {sender:myAccount, subject:theSubject}
tell newMessage
set visible to true
make new bcc recipient with properties {address:thesenderstext}
make new to recipient at end of to recipients with properties {name:theName, address:myaddress}
end tell
activate

end tell

</code>

Now it needs a little tightning... ;)



[ Reply to This | # ]